XnLemon opened a new issue, #1082:
URL: https://github.com/apache/dubbo-go-pixiu/issues/1082
## Background
Pixiu Admin currently supports listing, creating, updating, and deleting
Cluster configurations. However, the React frontend still edits a Cluster as
raw YAML:
```yaml
name: local-cluster
type: Static
address: 127.0.0.1
port: 20880
```
The backend decodes this YAML directly into `config.Cluster` and writes it
to the existing etcd Cluster namespace. Validation such as the supported
discovery type, non-empty address, and valid port range mainly happens later
when the xDS snapshot is generated.
Compared with `AdminRouteBinding`, Cluster configuration currently lacks:
- a schema-driven structured form;
- field-level validation and defaults;
- draft and published state separation;
- diff preview and explicit publish feedback;
- revision history and rollback;
- protection for published or referenced Clusters;
- a repeatable Admin-to-runtime integration test.
This proposal goes beyond the legacy Vue/React parity tracked in #1043. It
continues the Admin configuration-model extension reserved by #1024.
## Proposed model
Introduce an Admin-facing Cluster object while preserving the existing Pixiu
runtime `config.Cluster` format:
```yaml
kind: AdminCluster
metadata:
name: user-provider
spec:
type: Static
endpoint:
address: 127.0.0.1
port: 20880
```
The first phase should only cover fields already supported by the current
runtime Cluster model:
- `name`;
- `type`;
- `address`;
- `port`.
The etcd/runtime Cluster ID should remain an internal stable identity rather
than a value users normally need to edit.
The Admin model should be compiled or adapted into the existing
`config.Cluster` structure, so this work does not require rewriting the Pixiu
Cluster Manager or xDS runtime.
## Implementation approach
### Backend
- Register an `AdminCluster` schema in the Admin schema registry.
- Define defaults and validation for:
- required and unique Cluster name;
- supported discovery type;
- non-empty address;
- port range `1-65535`;
- immutable runtime identity during updates.
- Allow incomplete or temporarily invalid drafts to be saved.
- Run strict validation before preview and publish.
- Add Cluster lifecycle APIs for:
- schema;
- validate and preview;
- draft status;
- diff;
- publish;
- history;
- rollback.
- Publish the Cluster to the existing runtime etcd key in an atomic
transaction.
- Preserve existing Cluster YAML and CRUD API compatibility during migration.
- Prevent ordinary draft deletion from silently removing a published Cluster.
- Reject deletion of a published Cluster that is still referenced by a
published Listener, or provide an explicit guarded removal workflow.
- Return clear field paths and messages for validation and publish failures.
Where practical, reuse or extract the lifecycle and revision mechanisms
already implemented for `AdminRouteBinding` instead of creating an unrelated
Cluster workflow.
### Frontend
Replace the Cluster YAML-only editor with a schema-driven editor containing:
- Cluster name input;
- discovery-type selector;
- endpoint address input;
- numeric port input;
- inline validation messages;
- draft status and publish feedback;
- diff and history views;
- rollback action;
- advanced YAML editing mode.
Changes made in the form and YAML editor should stay synchronized.
### Runtime and compatibility
Publishing must continue to produce the current Pixiu runtime Cluster
representation and use the existing xDS publication path.
This proposal must not change:
- Cluster Manager runtime behavior;
- load-balancing algorithms;
- health-check behavior;
- the meaning of existing Cluster YAML;
- Listener configuration semantics.
## Acceptance criteria
- [ ] Existing Cluster YAML can still be read, edited, and saved.
- [ ] An incomplete or invalid Cluster can be saved as a draft.
- [ ] Publishing rejects an empty name, unsupported type, empty address, or
port outside `1-65535`, with actionable field-level errors.
- [ ] A valid Cluster can be created through the structured form and
previewed as legacy runtime YAML.
- [ ] Draft and published Cluster configurations can be compared before
publishing.
- [ ] Publishing atomically updates the existing runtime Cluster
configuration.
- [ ] Published revisions can be queried and rolled back.
- [ ] Published or Listener-referenced Clusters are protected from
accidental deletion.
- [ ] The Cluster page retains an advanced YAML editing mode.
- [ ] Existing Cluster CRUD API clients remain compatible during migration.
- [ ] Backend unit tests cover schema validation, compilation, publication,
conflicts, history, rollback, and deletion protection.
- [ ] A repeatable integration test verifies Admin API -> etcd -> xDS ->
Pixiu runtime Cluster publication.
## Non-goals
- Redesigning the Pixiu Cluster Manager.
- Adding new discovery types.
- Introducing a new multi-endpoint runtime model.
- Redesigning Listener configuration in the same change.
- Adding multi-tenancy or RBAC.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]