Skip to content

add k8s rbac & project api#320

Open
mysekai7 wants to merge 1 commit intomasterfrom
cherry-pick-AIT-62790-to-master
Open

add k8s rbac & project api#320
mysekai7 wants to merge 1 commit intomasterfrom
cherry-pick-AIT-62790-to-master

Conversation

@mysekai7
Copy link
Copy Markdown
Contributor

@mysekai7 mysekai7 commented Nov 10, 2025

Summary by CodeRabbit

  • Documentation
    • Added API docs for Kubernetes resources: Connector, Project, RBAC (ClusterRole, ClusterRoleBinding, Role, RoleBinding), ServiceAccount, and User — including collection and resource endpoints.
    • Added a User CustomResourceDefinition reference with schema, status/subresource, and display columns for API consumers.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Nov 10, 2025

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: cb5bc60b-54f9-41d2-8920-d19576e7d584

📥 Commits

Reviewing files that changed from the base of the PR and between 6594ef3 and 5d43da8.

📒 Files selected for processing (13)
  • docs/en/apis/kubernetes_apis/connector/connector.mdx
  • docs/en/apis/kubernetes_apis/connector/index.mdx
  • docs/en/apis/kubernetes_apis/project/index.mdx
  • docs/en/apis/kubernetes_apis/project/project.mdx
  • docs/en/apis/kubernetes_apis/rbac/clusterrole.mdx
  • docs/en/apis/kubernetes_apis/rbac/clusterrolebinding.mdx
  • docs/en/apis/kubernetes_apis/rbac/index.mdx
  • docs/en/apis/kubernetes_apis/rbac/role.mdx
  • docs/en/apis/kubernetes_apis/rbac/rolebinding.mdx
  • docs/en/apis/kubernetes_apis/serviceaccount/index.mdx
  • docs/en/apis/kubernetes_apis/serviceaccount/serviceaccount.mdx
  • docs/en/apis/kubernetes_apis/user/index.mdx
  • docs/en/apis/kubernetes_apis/user/user.mdx
✅ Files skipped from review due to trivial changes (12)
  • docs/en/apis/kubernetes_apis/user/index.mdx
  • docs/en/apis/kubernetes_apis/connector/index.mdx
  • docs/en/apis/kubernetes_apis/serviceaccount/index.mdx
  • docs/en/apis/kubernetes_apis/project/index.mdx
  • docs/en/apis/kubernetes_apis/rbac/rolebinding.mdx
  • docs/en/apis/kubernetes_apis/user/user.mdx
  • docs/en/apis/kubernetes_apis/rbac/index.mdx
  • docs/en/apis/kubernetes_apis/project/project.mdx
  • docs/en/apis/kubernetes_apis/rbac/role.mdx
  • docs/en/apis/kubernetes_apis/serviceaccount/serviceaccount.mdx
  • docs/en/apis/kubernetes_apis/rbac/clusterrole.mdx
  • docs/en/apis/kubernetes_apis/rbac/clusterrolebinding.mdx
🚧 Files skipped from review as they are similar to previous changes (1)
  • docs/en/apis/kubernetes_apis/connector/connector.mdx

Walkthrough

Adds new MDX documentation pages for multiple Kubernetes API groups (Connector, Project, RBAC, ServiceAccount, User) and a new CustomResourceDefinition YAML for the User resource (auth.alauda.io/v1).

Changes

Cohort / File(s) Summary
API Documentation Index Files
docs/en/apis/kubernetes_apis/connector/index.mdx, docs/en/apis/kubernetes_apis/project/index.mdx, docs/en/apis/kubernetes_apis/rbac/index.mdx, docs/en/apis/kubernetes_apis/serviceaccount/index.mdx, docs/en/apis/kubernetes_apis/user/index.mdx
Added new index MDX pages with front matter and an Overview component (empty overviewHeaders).
Connector API
docs/en/apis/kubernetes_apis/connector/connector.mdx
New Connector API doc (dex.coreos.com/v1) with OpenAPIPath entries for namespace-scoped collection and resource routes.
Project API
docs/en/apis/kubernetes_apis/project/project.mdx
New Project API doc (auth.alauda.io/v1) with OpenAPIPath entries and K8sCrd reference for projects.
RBAC APIs
docs/en/apis/kubernetes_apis/rbac/clusterrole.mdx, docs/en/apis/kubernetes_apis/rbac/clusterrolebinding.mdx, docs/en/apis/kubernetes_apis/rbac/role.mdx, docs/en/apis/kubernetes_apis/rbac/rolebinding.mdx
Added RBAC resource docs (rbac.authorization.k8s.io/v1) with collection and resource OpenAPIPath entries; many paths include pathPrefix="/kubernetes/{cluster}".
ServiceAccount API
docs/en/apis/kubernetes_apis/serviceaccount/index.mdx, docs/en/apis/kubernetes_apis/serviceaccount/serviceaccount.mdx
Added ServiceAccount index and resource MDX pages (v1) with namespace-scoped OpenAPIPath entries.
User API
docs/en/apis/kubernetes_apis/user/index.mdx, docs/en/apis/kubernetes_apis/user/user.mdx
Added User index and resource docs (auth.alauda.io/v1) with OpenAPIPath entries and K8sCrd reference for users.
CRD Definition
docs/shared/crds/auth.alauda.io_users.yaml
Added comprehensive CustomResourceDefinition for User (users.auth.alauda.io) including OpenAPI v3 schema, printer columns, status subresource, required fields, and preserved unknown fields.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • chinameok
  • fanzy618

Poem

🐰 I nibble docs at break of day,
New CRDs and paths in tidy array—
Connectors, users, roles take flight,
Pages sprout beneath my light.
Hooray for docs; I hop away! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Title check ⚠️ Warning The title mentions RBAC and project APIs, which are partially covered, but the PR adds significantly more: connector, serviceaccount, user, and rbac documentation. Update the title to more accurately reflect all major additions, such as 'add kubernetes API documentation for rbac, project, connector, serviceaccount, and user' or similar.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cherry-pick-AIT-62790-to-master

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (1)
docs/shared/crds/auth.alauda.io_users.yaml (1)

107-107: Inconsistent timestamp field format.

Line 107: last_login_time is typed as string with no format specification. For consistency and validation, consider specifying format: date-time to ensure proper timestamp validation and serialization, aligning with the expired field structure (lines 71-76).

Apply this diff for consistency:

                last_login_time:
+                 format: date-time
                  type: string
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 548d110 and 6594ef3.

📒 Files selected for processing (14)
  • docs/en/apis/kubernetes_apis/connector/connector.mdx (1 hunks)
  • docs/en/apis/kubernetes_apis/connector/index.mdx (1 hunks)
  • docs/en/apis/kubernetes_apis/project/index.mdx (1 hunks)
  • docs/en/apis/kubernetes_apis/project/project.mdx (1 hunks)
  • docs/en/apis/kubernetes_apis/rbac/clusterrole.mdx (1 hunks)
  • docs/en/apis/kubernetes_apis/rbac/clusterrolebinding.mdx (1 hunks)
  • docs/en/apis/kubernetes_apis/rbac/index.mdx (1 hunks)
  • docs/en/apis/kubernetes_apis/rbac/role.mdx (1 hunks)
  • docs/en/apis/kubernetes_apis/rbac/rolebinding.mdx (1 hunks)
  • docs/en/apis/kubernetes_apis/serviceaccount/index.mdx (1 hunks)
  • docs/en/apis/kubernetes_apis/serviceaccount/serviceaccount.mdx (1 hunks)
  • docs/en/apis/kubernetes_apis/user/index.mdx (1 hunks)
  • docs/en/apis/kubernetes_apis/user/user.mdx (1 hunks)
  • docs/shared/crds/auth.alauda.io_users.yaml (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Cloudflare Pages
🔇 Additional comments (12)
docs/en/apis/kubernetes_apis/connector/index.mdx (1)

1-6: Empty YAML front matter may omit necessary metadata.

The file has empty front matter delimiters (lines 1-2). Typically, MDX pages include metadata such as title, sidebar_label, or custom fields. Verify if this is intentional per your documentation template standards or if metadata should be populated.

docs/en/apis/kubernetes_apis/connector/connector.mdx (1)

1-5: LGTM!

The Connector API documentation is well-structured with appropriate OpenAPIPath entries for listing and retrieving individual connectors.

docs/en/apis/kubernetes_apis/rbac/rolebinding.mdx (1)

1-5: LGTM!

The RoleBinding documentation correctly uses namespace-scoped paths with pathPrefix for cluster context. The API endpoints are accurate for the resource type.

docs/en/apis/kubernetes_apis/rbac/clusterrole.mdx (1)

1-5: LGTM!

The ClusterRole documentation correctly uses cluster-scoped paths (no namespace segment) with appropriate pathPrefix. The API endpoints are accurate.

docs/en/apis/kubernetes_apis/project/index.mdx (1)

1-6: Empty YAML front matter may omit necessary metadata.

Similar to other index files, this page has empty front matter. Verify if metadata (e.g., title, sidebar_label) should be populated per your documentation standards.

docs/en/apis/kubernetes_apis/user/index.mdx (1)

1-6: Empty YAML front matter may omit necessary metadata.

This file follows the same pattern as other index files with empty front matter. Confirm whether metadata should be populated per your documentation template standards.

docs/en/apis/kubernetes_apis/serviceaccount/index.mdx (1)

1-6: Empty YAML front matter may omit necessary metadata.

Consistent with other index pages in this PR, this file has empty front matter. Verify if metadata should be included per your documentation standards.

docs/en/apis/kubernetes_apis/rbac/clusterrolebinding.mdx (1)

1-5: Fix incorrect API paths for cluster-scoped resource.

ClusterRoleBinding is a cluster-scoped Kubernetes resource and should not include /namespaces/{namespace}/ in its API paths. The current paths are incompatible with Kubernetes API conventions. Correct paths should omit the namespace segment, matching the structure used in clusterrole.mdx.

Apply this diff to correct the API paths:

 # ClusterRoleBinding [rbac.authorization.k8s.io/v1]
 
-<OpenAPIPath path="/apis/rbac.authorization.k8s.io/v1/namespaces/{namespace}/clusterrolebindings" pathPrefix="/kubernetes/{cluster}" />
+<OpenAPIPath path="/apis/rbac.authorization.k8s.io/v1/clusterrolebindings" pathPrefix="/kubernetes/{cluster}" />
 
-<OpenAPIPath path="/apis/rbac.authorization.k8s.io/v1/namespaces/{namespace}/clusterrolebindings/{name}" pathPrefix="/kubernetes/{cluster}" />
+<OpenAPIPath path="/apis/rbac.authorization.k8s.io/v1/clusterrolebindings/{name}" pathPrefix="/kubernetes/{cluster}" />

Likely an incorrect or invalid review comment.

docs/en/apis/kubernetes_apis/rbac/index.mdx (1)

1-2: Empty YAML front matter with no metadata.

The front matter contains only delimiters (---\n---) with no key-value pairs. If metadata (e.g., sidebar labels, description) is needed, populate it; otherwise, consider removing the front matter entirely for clarity.

docs/en/apis/kubernetes_apis/serviceaccount/serviceaccount.mdx (1)

1-5: Documentation structure looks good.

Consistent with standard Kubernetes API documentation pattern. ServiceAccount entries are properly namespaced with the /kubernetes/{cluster} path prefix, and no custom CRD declaration is needed.

docs/en/apis/kubernetes_apis/rbac/role.mdx (1)

1-5: Documentation structure is consistent and well-formed.

Standard Kubernetes RBAC Role endpoints are properly documented with cluster path prefix. No issues identified.

docs/en/apis/kubernetes_apis/user/user.mdx (1)

1-6: Documentation structure is consistent with custom API pattern.

User API documentation follows the established pattern for custom APIs under the auth.alauda.io group. OpenAPI paths and CRD declaration are properly configured.

Comment on lines +1 to +6
# Project [auth.alauda.io/v1]
<OpenAPIPath path="/apis/auth.alauda.io/v1/projects" />

<OpenAPIPath path="/apis/auth.alauda.io/v1/projects/{name}" />

<K8sCrd name="projects.auth.alauda.io" />
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Verify corresponding CRD file exists for projects.auth.alauda.io.

Line 6 references a CRD declaration for projects.auth.alauda.io, but the corresponding CRD YAML file is not included in this PR for review. Ensure docs/shared/crds/auth.alauda.io_projects.yaml exists and is properly formatted.


🏁 Script executed:

#!/bin/bash
# Verify the Project CRD file exists and is valid YAML
fd -e yaml docs/shared/crds | grep -i project
cat docs/shared/crds/auth.alauda.io_projects.yaml 2>/dev/null | head -20

Length of output: 369


🏁 Script executed:

#!/bin/bash
# Verify the Project CRD file exists using corrected fd syntax
echo "=== Searching for Project CRD files ==="
fd --full-path 'auth.alauda.io_projects.yaml' docs/shared/crds 2>/dev/null

echo "=== Checking if docs/shared/crds directory exists ==="
ls -la docs/shared/crds 2>&1 | head -30

echo "=== Listing all YAML files in CRDs directory ==="
fd . docs/shared/crds -e yaml 2>&1 | head -20

Length of output: 2568


The CRD file for projects.auth.alauda.io is missing.

Line 6 references <K8sCrd name="projects.auth.alauda.io" />, but the corresponding CRD YAML file docs/shared/crds/auth.alauda.io_projects.yaml does not exist in the repository. The docs/shared/crds/ directory contains 16 CRD files, including auth.alauda.io_users.yaml, but no projects CRD. Either create the missing CRD file or remove the K8sCrd reference if it is not yet implemented.

🤖 Prompt for AI Agents
In docs/en/apis/kubernetes_apis/project/project.mdx around lines 1-6, the page
references a CRD via <K8sCrd name="projects.auth.alauda.io" /> but the
corresponding YAML file docs/shared/crds/auth.alauda.io_projects.yaml is
missing; either add that CRD YAML to docs/shared/crds/ (matching naming
convention and contents of other CRDs) and commit it, or remove/replace the
<K8sCrd ... /> tag from this MDX if the CRD is not ready, ensuring the page
builds without broken references.

Comment on lines +82 to +85
description: Extra contains additional arbitrary metadata for the user from
third-party systems
type: object
x-kubernetes-preserve-unknown-fields: true
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Broad use of x-kubernetes-preserve-unknown-fields at multiple levels.

The CRD uses x-kubernetes-preserve-unknown-fields: true at both the spec level (line 85) and root level (line 134). While this enables flexibility for third-party integrations (noted in the extra field comment), it also:

  • Allows arbitrary fields that may mask schema validation issues
  • Increases the risk of unintended data acceptance
  • Makes schema evolution harder to track

Consider narrowing the preserve-unknown-fields scope to only the extra field if possible, or document the rationale for the broader application.

Also applies to: 134-134

Comment on lines +112 to +115
old_password:
type: string
password:
type: string
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

⚠️ Security concern: Plain-text password fields in CRD spec.

The password and old_password fields are stored as plain strings in the User resource spec. Kubernetes resources are persisted in etcd by default, which is not the appropriate place for credential storage. Credentials should be managed via Kubernetes Secrets.

Consider:

  1. Removing password fields from the spec and managing them separately via Secrets.
  2. If passwords must be included, ensure etcd encryption and access controls are strictly configured.
  3. Document the security implications and expected access restrictions.

@cloudflare-workers-and-pages
Copy link
Copy Markdown

Deploying alauda-container-platform with  Cloudflare Pages  Cloudflare Pages

Latest commit: 6594ef3
Status: ✅  Deploy successful!
Preview URL: https://c527a7c6.alauda-container-platform.pages.dev
Branch Preview URL: https://cherry-pick-ait-62790-to-mas.alauda-container-platform.pages.dev

View logs

@JounQin
Copy link
Copy Markdown
Member

JounQin commented Mar 30, 2026

/doc-pr-build

@JounQin JounQin force-pushed the cherry-pick-AIT-62790-to-master branch from 6594ef3 to 5d43da8 Compare March 30, 2026 08:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants