Skip to content

dbaas: add acl list, create, delete and update commands - #923

Draft
pierre-emmanuelJ wants to merge 2 commits into
masterfrom
pej/sc-104243/cli-dbaas-acl
Draft

pierre-emmanuelJ wants to merge 2 commits into
masterfrom
pej/sc-104243/cli-dbaas-acl

Conversation

@pierre-emmanuelJ

Copy link
Copy Markdown
Member

Description

exo dbaas acl only had show, for ClickHouse. This adds the rest of the tree for the services whose ACLs the API lets us manage. [sc-104243]

  • exo dbaas acl list|create|delete NAME ... for Kafka (topic and Schema Registry entries) and OpenSearch (index entries); acl update for OpenSearch (ACL toggles, permission of an entry); acl show now also covers Kafka and OpenSearch. The service is a positional name and its type is detected, as in exo dbaas user.
  • Deliberately not covered, for lack of API calls: updating a Kafka entry (there is only create and delete, and the command says so rather than deleting and re-creating behind the user's back), and any write on ClickHouse ACLs (read-only in the API).
  • Compatibility: acl show on a ClickHouse service keeps its output, at the cost of one extra call to find the service type; on other service types it now fails with an explicit "unsupported" error instead of an API error.

Checklist

(For exoscale contributors)

  • Changelog updated (under Unreleased block, and add the Pull Request #number for each bit you add to the CHANGELOG.md)
  • Testing

Testing

  • Unit tests for each command against an HTTP test server (go test ./cmd/dbaas/...), make build, gofmt and go vet on the touched packages, and the --help of each subcommand.
  • Two e2e scenarios are added (kafka_acl_crud.txtar, opensearch_acl_crud.txtar) but have not been run: they create billed Kafka and OpenSearch services. The commands have not been exercised against the real API yet.

Note

AI assistance: code, tests, PR description.

🤖 Generated with Claude Code

pierre-emmanuelJ and others added 2 commits October 2, 2026 12:35
Manage the ACLs of Kafka (topic and Schema Registry) and OpenSearch
services under `exo dbaas acl`, with the service type detected from the
service name. `acl show` now also covers these two types.

Kafka entries cannot be updated and ClickHouse ACLs are read-only: the
API has no call for either.

[sc-104243]

AI-assisted: true
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
AI-assisted: true
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@pierre-emmanuelJ
pierre-emmanuelJ requested a review from a team October 2, 2026 12:36
// updateOpensearchAclConfig replaces the ACL configuration of an OpenSearch
// Database Service: the API only exposes it as a whole.
func updateOpensearchAclConfig(ctx context.Context, client *v3.Client, name string, config v3.DBAASOpensearchAclConfig, message string) error {
op, err := client.UpdateDBAASOpensearchAclConfig(ctx, name, config)

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.

I think we have an omitempty gremlin here.

The API insists on getting acls, but the generated tag drops it when the list is empty. That hits both a fresh config and deleting the final ACL, and the live e2e is currently falling over with Invalid value in [3].acls - should be a Collection.

Would it make sense to mark the field as required in the DBaaS source schema, regenerate egoscale, and turn nil into [] before this PUT?

case "kafka":
return c.deleteKafka(ctx, client)
case "opensearch":
return c.deleteOpensearch(ctx, client)

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.

I think this has a slightly alarming trapdoor.

For OpenSearch, --kafka-topic, --permission, and extra positional arguments are accepted but ignored. That leaves OpensearchIndex empty, which means delete every ACL for this user.

Could we reject those selectors before dispatch, so a Kafka-shaped typo cannot turn into delete-all?

return errors.New("--opensearch-index is required for an opensearch service")
}

config, err := client.GetDBAASOpensearchAclConfig(ctx, c.Name)

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.

Is there some API-side revision, ETag, or locking magic here that I'm missing?

Each command reads the full config, tweaks one entry, then sends the whole thing back. Two commands can both succeed, then whichever PUT lands last quietly eats the other change.

If there isn't a CAS guarantee, I think OpenSearch writes need an atomic API operation before we expose them here.

@natalie-o-perret natalie-o-perret left a comment

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.

These gremlins look blocking to me, especially the invalid empty-ACL payload, the delete-all trapdoor, and the lost-update path. Requesting changes until those are nailed down.

This branch has not been deployed

No deployments
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