canonical / canonical/data-platform-libs

s3-lib sets 'bucket: relations-$id' on requester side, makes it incompatible with s3-integrator track 2/edge rev167

Open
#240 7 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
13
Forks
12
PR merge metrics
No merged PRs in 30d

Description

## Issue

Bugreport to Postgresql: https://github.com/canonical/postgresql-operator/issues/1043 (PG failed to work with s3-integrator 2/edge rev167)

## Steps to reproduce
1. juju deploy mysql # or postgresql
2. juju deploy s3-integrator --channel 2/edge
3. juju config s3-integrator endpoint="https://s3.amazonaws.com" region="us-east-1" bucket="mybucket" path="mypath"
5. jujusecret=$(juju add-secret s3-integrator access-key=myaccess secret-key=mysecret)
6. juju grant-secret ${jujusecret} s3-integrator
7. juju config s3-integrator credentials=${jujusecret}
8. juju relate s3-integrator mysql

## Actual behavior
Error on MySQL side:
```
unit-mysql-0: 16:12:30 INFO unit.mysql/0.juju-log Listing subdirectories from S3 bucket=relation-9, path=alutay_1755180485
unit-mysql-0: 16:12:31 ERROR unit.mysql/0.juju-log Bucket relation-9 does not exist
```

It happens because s3-integrator returned bucket as `relations-9` and not pre-configured `mybucket`.
Which happends because s3-lib LIBAPI=6 set bucket = relation-id [here](https://github.com/canonical/data-platform-libs/blob/bb180d68effc556bc61627d5d2d4e82301cc7fdd/lib/charms/data_platform_libs/v0/s3.py#L708).

Image

## Expected behaviour

S3 library should NOT set bucket name by default, as it is [optional](https://github.com/canonical/data-platform-libs/blob/bb180d68effc556bc61627d5d2d4e82301cc7fdd/lib/charms/data_platform_libs/v0/s3.py#L643).

## Versions
Juju CLI: 3.6.8
Juju agent: 3.6.8

```
ubuntu@juju366:~$ juju status
Model Controller Cloud/Region Version SLA Timestamp
test67 lxd localhost/localhost 3.6.8 unsupported 17:13:09+02:00

App Version Status Scale Charm Channel Rev Exposed Message
mysql 8.0.41-0ubun... active 1 mysql 8.0/stable 366 no
postgresql 16.9 active 1 postgresql 16/edge 874 no
s3-new active 1 s3-integrator 2/edge 167 no

Unit Workload Agent Machine Public address Ports Message
mysql/0* active idle 1 10.176.3.183 3306,33060/tcp Primary
postgresql/0* active idle 0 10.176.3.223 5432/tcp Primary
s3-new/0* active idle 3 10.176.3.82

Machine State Address Inst id Base AZ Message
0 started 10.176.3.223 juju-cbd943-0 ubuntu@24.04 Running
1 started 10.176.3.183 juju-cbd943-1 ubuntu@22.04 Running
3 started 10.176.3.82 juju-cbd943-3 ubuntu@24.04 Running
```

## Additional context

Proposal: change the presidency order in s3-integrator channel 2/edge.
Use requester-bucket value IF no bucket set in s3-charm-config only.
It will keep compatibility with old behavior, allows requester charm request default bucket name (e.g. workdpress charm may request `wordpress` bucket by default) and Juju Admins can overwrite the request using s3-integrator config bucket='wordpress-test-bucket'.

If bucket is empty in relation and config, either:
* return no bucket in relation => requester charm decide on name
* continue returning relation-$id like now

P.S. bucket name in relation sets by `requestor` and not `insistor` ;-)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.