Skip to content

Commit 032bb4d

Browse files
GatewayJcxymds
andauthored
feat(console): add GET/PUT tenant YAML API endpoint and PR template (#96)
* feat(console): add GET/PUT tenant YAML API endpoint Add /api/v1/namespaces/{namespace}/tenants/{name}/yaml for reading and editing the full Tenant CR as YAML (similar to MinIO operator). GET: returns the complete Tenant CR serialized as YAML (managedFields stripped for readability). PUT: accepts edited YAML, validates name/namespace match, pool uniqueness, and safely updates only spec/labels/annotations/finalizers while preserving resourceVersion and immutable metadata. Also applies Prettier formatting to existing console-web files. Made-with: Cursor * fix(console-web): add .dockerignore to fix Docker build (#97) * feat(console): add GET/PUT tenant YAML API endpoint and PR template Add /api/v1/namespaces/{namespace}/tenants/{name}/yaml for reading and editing the full Tenant CR as YAML (similar to MinIO operator). GET: returns the complete Tenant CR serialized as YAML (managedFields stripped for readability). PUT: accepts edited YAML, validates name/namespace match, pool uniqueness, and safely updates only spec/labels/annotations/finalizers while preserving resourceVersion and immutable metadata. Also adds AGENTS.md (global + .github), PR template, and applies Prettier formatting to existing console-web files. Made-with: Cursor * fix(console-web): add .dockerignore to fix Docker build (node_modules copy conflict) Made-with: Cursor * feat : Tenant yaml edit * feat: add status ,Namespace ,searchbox * feat: Modify tenant action * feat: yaml copy and edit * fix: handleUnauthorized logout * feat(console): add tenant state counts API and state filtering * feat:Tenant state number * feat: total card * feat: remove cluster router * feat: UI Box * feat: number count * feat: topology/overview api * fix: parseSizeToBytes * Console yaml (#98) * feat(console): encryption and security-context APIs with validation - Add GET/PUT encryption and security-context handlers and routes - Require kmsSecret for Vault backend in reconcile and API validation - Validate vault.endpoint and kmsSecretName in update_encryption (400 on invalid) - Apply rustfmt and Prettier formatting Made-with: Cursor * chore(console-web): Node >=20, .nvmrc, Prettier and ESLint fixes - Relax Node requirement from >=22 to >=20 for pre-commit in CI/dev - Add .nvmrc (22) for nvm use - Apply Prettier to page.tsx, tenants pages, globals.css, topology mock - Fix useEffect deps: add initialYamlEditable in tenant-detail-client Made-with: Cursor --------- Co-authored-by: 马登山 <cxymds@qq.com>
1 parent 9bf017b commit 032bb4d

56 files changed

Lines changed: 6155 additions & 934 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.claude/settings.local.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"permissions": {
3+
"allow": [
4+
"Bash(cargo build:*)",
5+
"Bash(cargo test:*)",
6+
"Bash(cargo clippy:*)"
7+
]
8+
}
9+
}

.github/AGENTS.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# GitHub Workflow Instructions
2+
3+
Applies to `.github/` and repository pull-request operations.
4+
5+
## Pull Requests
6+
7+
- PR titles and descriptions must be in English.
8+
- Use `.github/pull_request_template.md` for every PR body.
9+
- Keep all template section headings.
10+
- Use `N/A` for non-applicable sections.
11+
- Include verification commands in the PR details.
12+
- For `gh pr create` and `gh pr edit`, always write markdown body to a file and pass `--body-file`.
13+
- Do not use multiline inline `--body`; backticks and shell expansion can corrupt content or trigger unintended commands.
14+
- Recommended pattern:
15+
- `cat > /tmp/pr_body.md <<'EOF'`
16+
- `...markdown...`
17+
- `EOF`
18+
- `gh pr create ... --body-file /tmp/pr_body.md`
19+
20+
## CI Alignment
21+
22+
When changing CI-sensitive behavior, keep local validation aligned with `.github/workflows/ci.yml`.
23+
24+
Current `test-and-lint` gate includes:
25+
26+
- `cargo fmt --all --check`
27+
- `cargo clippy --all-features -- -D warnings`
28+
- `cargo test --all`
29+
- `cd console-web && npm run lint`
30+
- `cd console-web && npx prettier --check "**/*.{ts,tsx,js,jsx,json,css,md}"`

.github/pull_request_template.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<!--
2+
Pull Request Template for RustFS Operator
3+
-->
4+
5+
## Type of Change
6+
- [ ] New Feature
7+
- [ ] Bug Fix
8+
- [ ] Documentation
9+
- [ ] Performance Improvement
10+
- [ ] Test/CI
11+
- [ ] Refactor
12+
- [ ] Other:
13+
14+
## Related Issues
15+
<!-- List related Issue numbers, e.g. #123 -->
16+
17+
## Summary of Changes
18+
<!-- Briefly describe the main changes and motivation for this PR -->
19+
20+
## Checklist
21+
- [ ] I have read and followed the [CONTRIBUTING.md](CONTRIBUTING.md) guidelines
22+
- [ ] Passed `make pre-commit` (fmt-check + clippy + test + console-lint + console-fmt-check)
23+
- [ ] Added/updated necessary tests
24+
- [ ] Documentation updated (if needed)
25+
- [ ] CHANGELOG.md updated under `[Unreleased]` (if user-visible change)
26+
- [ ] CI/CD passed (if applicable)
27+
28+
## Impact
29+
- [ ] Breaking change (CRD/API compatibility)
30+
- [ ] Requires doc/config/deployment update
31+
- [ ] Other impact:
32+
33+
## Verification
34+
<!-- Include commands reviewers can run to verify the change -->
35+
```bash
36+
make pre-commit
37+
```
38+
39+
## Additional Notes
40+
<!-- Any extra information for reviewers -->
41+
42+
---
43+
44+
Thank you for your contribution! Please ensure your PR follows the community standards ([CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md)) and sign the CLA if this is your first contribution.

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,5 @@ console-web/node_modules/
2222

2323
# Docs / summaries (local or generated)
2424
CONSOLE-INTEGRATION-SUMMARY.md
25-
SCRIPTS-UPDATE.md
25+
SCRIPTS-UPDATE.md
26+
AGENTS.md

AGENTS.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# RustFS Operator Agent Instructions (Global)
2+
3+
This root file keeps repository-wide rules only.
4+
Use the nearest subdirectory `AGENTS.md` for path-specific guidance.
5+
6+
## Rule Precedence
7+
8+
1. System/developer instructions.
9+
2. This file (global defaults).
10+
3. The nearest `AGENTS.md` in the current path (more specific scope wins).
11+
12+
If repo-level instructions conflict, follow the nearest file and keep behavior aligned with CI.
13+
14+
## Communication and Language
15+
16+
- Respond in the same language used by the requester.
17+
- Keep source code, comments, commit messages, and PR title/body in English.
18+
19+
## Sources of Truth
20+
21+
- Workspace layout: `Cargo.toml`
22+
- Project overview and architecture: `CLAUDE.md`
23+
- Local quality commands: `Makefile`
24+
- CI quality gates: `.github/workflows/ci.yml`
25+
- PR template: `.github/pull_request_template.md`
26+
27+
Avoid duplicating long command matrices in instruction files.
28+
Reference the source files above instead.
29+
30+
## Mandatory Before Commit
31+
32+
Run and pass:
33+
34+
```bash
35+
make pre-commit
36+
```
37+
38+
This runs: `fmt-check``clippy``test``console-lint``console-fmt-check`.
39+
40+
Do not commit when required checks fail.
41+
42+
## Git and PR Baseline
43+
44+
- Use feature branches based on the latest `main`.
45+
- Follow Conventional Commits, with subject length <= 72 characters.
46+
- Keep PR title and description in English.
47+
- Use `.github/pull_request_template.md` and keep all section headings.
48+
- Use `N/A` for non-applicable template sections.
49+
- Include verification commands in the PR description.
50+
- When using `gh pr create`/`gh pr edit`, use `--body-file` instead of inline `--body` for multiline markdown:
51+
```bash
52+
cat > /tmp/pr_body.md <<'EOF'
53+
...markdown...
54+
EOF
55+
gh pr create ... --body-file /tmp/pr_body.md
56+
```
57+
58+
## Security Baseline
59+
60+
- Never commit secrets, credentials, or key material.
61+
- Use environment variables or vault tooling for sensitive configuration.
62+
- Credential Secrets must contain `accesskey` and `secretkey` keys (both valid UTF-8, minimum 8 characters).
63+
64+
## Architecture Constraints
65+
66+
- All pools within a single Tenant form ONE unified RustFS cluster.
67+
- Do not assume pool-based storage tiering. For separate clusters, use separate Tenants.
68+
- Error handling uses `snafu`. New files must include Apache 2.0 license headers.
69+
- Do not invent RustFS ports/constants; verify against `CLAUDE.md` and official sources.

Makefile

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
.PHONY: pre-commit fmt fmt-check clippy test build help console-lint console-fmt console-fmt-check
15+
.PHONY: pre-commit fmt fmt-check clippy test build docker-build-operator docker-build-console-web docker-build-all help console-lint console-fmt console-fmt-check
1616

1717
# 默认目标
1818
help:
@@ -25,6 +25,9 @@ help:
2525
@echo " make clippy - 运行 clippy 检查"
2626
@echo " make test - 运行 Rust 测试"
2727
@echo " make build - 构建项目"
28+
@echo " make docker-build-operator - 构建 operator 镜像 (IMAGE_REPO?=rustfs/operator IMAGE_TAG?=dev)"
29+
@echo " make docker-build-console-web - 构建 console-web 前端镜像 (CONSOLE_WEB_IMAGE_REPO?=rustfs/console-web CONSOLE_WEB_IMAGE_TAG?=dev)"
30+
@echo " make docker-build-all - 构建 operator + console-web 两个镜像"
2831
@echo " make console-lint - 前端 ESLint 检查 (console-web)"
2932
@echo " make console-fmt - 前端 Prettier 自动格式化 (console-web)"
3033
@echo " make console-fmt-check - 前端 Prettier 格式检查 (console-web)"
@@ -64,3 +67,16 @@ console-fmt-check:
6467
# 构建
6568
build:
6669
cargo build --release
70+
71+
# 构建 Docker 镜像(operator:含 controller + console API;console-web:前端静态资源)
72+
IMAGE_REPO ?= rustfs/operator
73+
IMAGE_TAG ?= dev
74+
docker-build-operator:
75+
docker build -t $(IMAGE_REPO):$(IMAGE_TAG) .
76+
77+
CONSOLE_WEB_IMAGE_REPO ?= rustfs/console-web
78+
CONSOLE_WEB_IMAGE_TAG ?= dev
79+
docker-build-console-web:
80+
docker build -t $(CONSOLE_WEB_IMAGE_REPO):$(CONSOLE_WEB_IMAGE_TAG) -f console-web/Dockerfile console-web
81+
82+
docker-build-all: docker-build-operator docker-build-console-web
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"permissions": {
3+
"allow": [
4+
"Bash(npx next:*)",
5+
"mcp__ide__getDiagnostics",
6+
"Bash(npx tsc:*)",
7+
"WebFetch(domain:lh3.googleusercontent.com)",
8+
"WebFetch(domain:lh3.google.com)",
9+
"WebFetch(domain:gemini.google.com)",
10+
"Bash(grep -l \"RiFolder\" node_modules/@remixicon/react/dist/*.mjs 2>/dev/null | head -3 || grep \"RiFolder\" node_modules/@remixicon/react/dist/index.d.ts 2>/dev/null | head -5 || echo \"try other path\"; find node_modules/@remixicon -name \"*.d.ts\" -maxdepth 3 2>/dev/null | head -3)"
11+
]
12+
}
13+
}

console-web/.dockerignore

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Dependencies: install inside container; avoid copying host node_modules (pnpm symlinks break COPY)
2+
node_modules
3+
4+
# Build outputs
5+
.next
6+
out
7+
build
8+
9+
# Git and IDE
10+
.git
11+
.gitignore
12+
.vscode
13+
.DS_Store
14+
15+
# Env and debug
16+
.env*
17+
*.pem
18+
*.log
19+
20+
# Test and misc
21+
coverage
22+
.vercel
23+
*.tsbuildinfo
24+
next-env.d.ts

console-web/.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
22

console-web/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ Then configure the backend with `CORS_ALLOWED_ORIGINS` (see deploy README).
5050

5151
## Environment variables
5252

53-
| Variable | Description | Default |
54-
|----------|-------------|--------|
55-
| `NEXT_PUBLIC_BASE_PATH` | Base path for the app (e.g. `/console`) | `""` |
56-
| `NEXT_PUBLIC_API_BASE_URL` | API base URL (relative or absolute) | `"/api/v1"` |
53+
| Variable | Description | Default |
54+
| -------------------------- | --------------------------------------- | ----------- |
55+
| `NEXT_PUBLIC_BASE_PATH` | Base path for the app (e.g. `/console`) | `""` |
56+
| `NEXT_PUBLIC_API_BASE_URL` | API base URL (relative or absolute) | `"/api/v1"` |

0 commit comments

Comments
 (0)