Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Pebble identities #1594

Open
benhoyt opened this issue Feb 28, 2025 · 0 comments
Open

Add support for Pebble identities #1594

benhoyt opened this issue Feb 28, 2025 · 0 comments
Assignees
Labels

Comments

@benhoyt
Copy link
Collaborator

benhoyt commented Feb 28, 2025

We should add Ops support for Pebble identity-related APIs: add, update, replace, and remove.

Design decisions:

  • Function names: probably Pebble and Container methods matching those on the Go client: get_identities, add_identities, replace_identities, remove_identities.
  • Or do we just want to add get_identities and replace_identities for now, since replacing is idempotent (which is what we want for charms) and also allows removal?
  • Should the argument be Mapping[str, pebble.Identity], strongly typed dataclasses matching the Go client.Identity type? In which case we'll need to add new types if we add new identity types, but that's probably okay (happens very slowly).

Typical call might look like this:

hashed = subprocess.run(['openssl', 'passwd', '-6'], capture_output=True, check=True).stdout
model.add_secret(hashed_password) # pseudo-code (but store it somewhere)
container.replace_identities({
    "web": pebble.Identity(access=pebble.MetricsAccess, basic=pebble.BasicIdentity(password=hashed)),
})

For documenting the above, generated API reference docs is probably fine. We should also write a doc for how to use them (with /v1/metrics) in a charm -- I'll open a separate issue for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants