diff --git a/README-ZH.md b/README-ZH.md new file mode 100644 index 0000000..b2475c8 --- /dev/null +++ b/README-ZH.md @@ -0,0 +1,56 @@ +
+ +
+ +> 项目尚在开发中,喜欢的同学可以点点 star、点点 watch 关注项目进度。 + +## 什么是 Kufu + +Kufu 读起来像是功夫的英文发音,由 Kubernetes 和 Fuse(用户文件系统)拼接而成。顾名思义 Kufu 是一个基于Kubernetes 和 Fuse 用户文件系统开发的开源项目。它可以实时同步 Kubernetes集群内的原生(Pod、Service 等)或 CRD 资源到使用者的本地文件系统,让用户可以像操作文件系统一样操作自己的Kubernetes 集群,无需再费力的查找和执行 kubectl 指令。 + +## 基本原理 + +Kufu 利用 [kube](https://github.com/kube-rs/kube) 项目监听 Kubernetes 集群的资源变动,实时同步到使用 [sled](https://github.com/spacejam/sled)(Rust编写的本地kv数据库)中。(这里和传统的控制器开发模式不一致的地方是:Kufu 仅仅 list-watch 资源变化,但是没有把监听对象缓存到内存中,这里是考虑到 Kufu 的使用环境一般为开发者的本地电脑,尽量不占用开发者电脑的内存。) + +使用 [fuser](https://github.com/cberner/fuser) 库挂载用户文件系统到用户的电脑里,每次用户对该用户文件系统内的文件的操作都会映射为读取 sled 数据库内的内容并返回给用户。 + +## 使用方式 + +[![asciicast](https://asciinema.org/a/566722.svg)](https://asciinema.org/a/566722) + +## 本地开发 + +### MacOs + +1. 安装 [MacFuse](https://osxfuse.github.io/) +2. 克隆项目 + ```shell + git clone https://github.com/yangsoon/kufu.git + ``` +3. 修改 `test/config` 文件 + ```yaml + mount: + path: ./test/k8s # 指定用户文件系统的挂载位置 + data-path: ./test/.data # sled数据库数据存储位置 + resources: # 指定资源监听类型 + - apiVersion: v1 + kind: Pod + - apiVersion: v1 + kind: Namespace + kube-configs: # 指定监听集群 kubeconfig 位置 + - config-path: ~/.kube/config + ``` +4. 本地测试运行 + ```shell + cargo run + ``` + +## 待做事项 + +- [x] POC 验证通过 +- [ ] 增加 workqueue 机制保证资源变更能够最终存储到本地 +- [ ] 完善 fuse 接口剩余接口实现 +- [ ] 支持更多原生资源的监听 +- [ ] 完善权限系统 +- [ ] 支持权限系统 + diff --git a/README.md b/README.md index b8b7308..b37eaaf 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,55 @@ -## Kufu +
+ +
-### What is Kufu -Kufu sounds like **kung fu**, It can help you manage K8S as you would a local file. +> The project is currently under development, and interested users can star and watch to stay updated on its progress. -You can get k8s pod resource just type `cat ./pod/hello`. +[中文](./README-ZH.md) -So please forget the large number of kubectl commands, and play your k8s with less burden. +## What is Kufu + +Kufu has a pronunciation similar to "kung fu" in English, and is a combination of Kubernetes and Fuse (user file system). As its name suggests, Kufu is an open-source project based on Kubernetes and Fuse user file system. It can synchronize native resources (Pod, Service, etc.) or CRD resources in Kubernetes cluster in real time to the user's local file system, allowing users to operate their Kubernetes cluster like a file system without having to search for and execute kubectl commands. + +## Basic Principles + +Kufu uses the [kube](https://github.com/kube-rs/kube) project to listen for changes in Kubernetes cluster resources and synchronizes them in real time to [sled](https://github.com/spacejam/sled) (a local KV database written in Rust). The difference from the traditional controller development mode is that Kufu only list-watch resource changes but does not cache the monitored objects in memory, as Kufu is generally used on developers' local computers and tries not to occupy too much memory. + +The [fuser](https://github.com/cberner/fuser) library is used to mount the user file system to the user's computer, and each operation on the files in this file system is mapped to reading the contents of sled database and returned to the user. + +## Usage + +[![asciicast](https://asciinema.org/a/566722.svg)](https://asciinema.org/a/566722) + +### Local Development +#### MacOs +1. Install [MacFuse](https://osxfuse.github.io/) +2. Clone the project + ```shell + git clone https://github.com/yangsoon/kufu.git + ``` +3. Modify the `test/config` file + + ```yaml + mount: + path: ./test/k8s # Specify the mount location of the user file system + data-path: ./test/.data # Location to store sled database data + resources: # Specify the resource monitoring types + - apiVersion: v1 + kind: Pod + - apiVersion: v1 + kind: Namespace + kube-configs: # Specify the kubeconfig location of the monitored cluster + - config-path: ~/.kube/config + ``` +4. Run the local + ```shell + cargo run + ``` + +## TODO + - [x] Verify POC + - [ ] Add workqueue mechanism to ensure that resource changes can eventually be stored locally + - [ ] Complete remaining fuse interface implementations + - [ ] Support monitoring of more native resources + - [ ] Improve the permission system + - [ ] Support permission system? \ No newline at end of file diff --git a/img/kufu.png b/img/kufu.png new file mode 100644 index 0000000..6fa5aa7 Binary files /dev/null and b/img/kufu.png differ