Skip to content

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

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

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

Conversation

@pierre-emmanuelJ

@pierre-emmanuelJ pierre-emmanuelJ commented Oct 2, 2026 •

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 safely. [sc-104243]

  • exo dbaas acl list NAME for Kafka (topic and Schema Registry entries) and OpenSearch (index entries), acl create|delete NAME USERNAME ... for Kafka (delete also takes the entry --id shown by acl list), and 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: OpenSearch writes, because the API only replaces the whole ACL configuration, without any revision check, so concurrent writes could drop one another; updating a Kafka entry (there is only create and delete); 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 (if the API key can't list services, it falls back to the ClickHouse ACL call, as before); 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

Note

AI assistance: code, tests, PR description.

🤖 Generated with Claude Code

@pierre-emmanuelJ
pierre-emmanuelJ requested a review from a team October 2, 2026 12:36
Comment thread cmd/dbaas/acl/acl_create.go Outdated
Comment thread cmd/dbaas/acl/acl_delete.go Outdated
Comment thread cmd/dbaas/acl/acl_create.go Outdated

@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.

@pierre-emmanuelJ
pierre-emmanuelJ force-pushed the pej/sc-104243/cli-dbaas-acl branch from 1f71272 to 22f2914 Compare October 14, 2026 13:00
@pierre-emmanuelJ
pierre-emmanuelJ marked this pull request as ready for review October 14, 2026 13:01

@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.

The OpenSearch gremlins are gone, nice one. I found two smaller blockers in the remaining ClickHouse and Kafka paths: keeping the released ClickHouse IAM contract, and making duplicate Kafka topic ACLs addressable by ID. Details inline.

Comment thread cmd/dbaas/acl/acl_show.go
}

acl, err := client.GetDBAASClickhouseAclConfig(ctx, c.Name)
dbType, err := dbaasServiceType(ctx, client, c.Name, c.Zone)

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.

Could we preserve the released ClickHouse permission contract here, perhaps by falling back to the direct ACL GET when type lookup is denied?

I think this gives the existing command a bigger IAM hat than it used to wear. Released acl show went straight to get-dbaas-clickhouse-acl-config, while this adds list-dbaas-services first. Those are separate IAM operations.

Focused setup: /dbaas-service returns 403 and the existing ClickHouse ACL endpoint returns 200.

$ go test ./cmd/dbaas/acl -run '^TestReviewClickhouseShowKeepsExistingPermissionContract$' -count=1 -v
ListDBAASServices: http response: Forbidden: forbidden
--- FAIL: TestReviewClickhouseShowKeepsExistingPermissionContract

Falling back to showClickhouseAcl when lookup fails kept the old key working, and the same check passed:

--- PASS: TestReviewClickhouseShowKeepsExistingPermissionContract
PASS
ok  github.com/exoscale/cli/cmd/dbaas/acl

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Done in 27a69f5: when listing the services is forbidden, acl show falls back to the direct ClickHouse ACL call, as before. Covered by TestDBAASClickhouseAclShowWithoutServiceList.

Comment thread cmd/dbaas/acl/acl_delete.go Outdated
case len(ids) == 0:
return fmt.Errorf("no matching ACL entry found for user %q in service %q", c.Username, c.Name)
case len(ids) > 1:
return fmt.Errorf("%d ACL entries match for user %q, use --permission to select one", len(ids), c.Username)

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.

Could we add an ID selector here, or otherwise make an exact duplicate addressable?

I think we have a tiny Kafka ACL Hotel California: exact duplicate topic entries can check in, but this command cannot check either one out. Aiven explicitly handles multiple entries with the same topic, username, and permission, and acl list already exposes their IDs. --permission remains ambiguous for those entries.

Focused setup: the ACL GET returns two alice / orders / read entries named topic-1 and topic-duplicate.

$ go test ./cmd/dbaas/acl -run '^TestReviewDuplicateKafkaTopicAclCanBeDeletedByID$' -count=1 -v
unknown flag: --id
--- FAIL: TestReviewDuplicateKafkaTopicAclCanBeDeletedByID

After adding --id topic-duplicate, the same check sent DELETE /topic/acl-config/topic-duplicate and passed:

--- PASS: TestReviewDuplicateKafkaTopicAclCanBeDeletedByID
PASS
ok  github.com/exoscale/cli/cmd/dbaas/acl

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Done in 27a69f5: acl delete NAME USERNAME --id ID, exclusive with the other selectors; the ID has to belong to USERNAME. The ambiguity error now lists the matching IDs, and the e2e scenario deletes one entry by --id.

pierre-emmanuelJ and others added 3 commits October 14, 2026 15:41
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>
The OpenSearch ACL configuration can only be read and replaced as a
whole: there is no atomic per-entry operation nor any revision check, so
two concurrent writes could silently drop one another. Until the API
offers one, `acl create` and `acl delete` only cover Kafka, and
`acl update` (OpenSearch only) is removed; `acl list` and `acl show`
still cover OpenSearch.

This also removes the delete-all default of `acl delete` on OpenSearch
and the empty `acls` PUT rejected by the API.

The Kafka e2e scenario uses startup-4: startup-2 plans are no longer
available on Kafka 3.9 and above.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tries

`acl show` used to call the ClickHouse ACL endpoint directly. Finding the
service type first needs the permission to list the services: when that
lookup is forbidden, fall back to the ClickHouse ACL call, so API keys
restricted to it keep working.

`acl delete` gains `--id`, the entry ID shown by `acl list`: exact
duplicate Kafka entries (same user, topic or resource, and permission)
can't be told apart by --permission. The ambiguity error now lists the
IDs of the matching entries.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@pierre-emmanuelJ
pierre-emmanuelJ force-pushed the pej/sc-104243/cli-dbaas-acl branch from 22f2914 to 27a69f5 Compare October 14, 2026 15:47
@pierre-emmanuelJ
pierre-emmanuelJ marked this pull request as draft October 15, 2026 08:45
@pierre-emmanuelJ
pierre-emmanuelJ marked this pull request as ready for review October 15, 2026 08:46

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