s3proxy-k8s

S3proxy Charmed Operator

Channel Revision Published Runs on
latest/edge 10 16 Mar 2023
Ubuntu 22.04
juju deploy s3proxy-k8s --channel edge
Show information

Platform:

charms.s3proxy_k8s.v0.object_storage

S3-Compatible Object Storage Library.

This library wraps relation endpoints using the s3 interface and provides a Python API both for requesting and providing per-application object storage.

Getting Started

To get started using the library, you just need to fetch the library using charmcraft.

cd some-charm
charmcraft fetch-lib charms.s3proxy_k8s.v0.object-storage

In the metadata.yaml of the charm, add the following:

requires:
    s3:
        interface: s3

Then, to initialise the library:

from charms.s3proxy_k8s.v0.object_storage import (ObjectStorageRequirer,
  ObjectStorageReadyEvent)

class SomeCharm(CharmBase):
  def __init__(self, *args):
    # ...
    self.blobstore = ObjectStorageRequirer(self, bucket="some-charm")
    # The following event is triggered when the Object Storage to be used
    # by this deployment of the `SomeCharm` is ready (or changes).
    self.framework.observe(
        self.blobstore.on.ready, self._on_object_storage_ready
    )

    def _on_object_storage_ready_ready(self, event: ObjectStorageReadyEvent):
        # Configure with:
        #  event.access_key
        #  event.secret_key
        #  event.path
        #  event.endpoint
        pass

class DataValidationError

Description

Raised when data validation fails on IPU relation data. None

class ObjectStorageDataProvidedEvent

Description

Event representing that object storage data has been provided for an app. None

class ObjectStorageDataRefreshEvent

Description

Request a refresh of data. None

class ObjectStorageProviderCharmEvents

Description

List of events that the auth provider charm can leverage. None

class SingleAuthObjectStorageProvider

Class for single authentication object storage providers.

Description

For now (with s3proxy), authentication details are the same for all clients, differing only in the bucket.

Methods

SingleAuthObjectStorageProvider. __init__( self , charm: CharmBase , relation_name: str , refresh_event )

SingleAuthObjectStorageProvider. update_endpoints( self , data , relation_id )

Description

Update relation data bags with endpoint information. None

class ObjectStorageReadyEvent

Description

Event representing that object storage data has been provided for an app. None

class ObjectStorageBrokenEvent

Description

Event representing that an object storage relation has been broken. None

class ObjectStorageRequirerCharmEvents

Description

List of events that the object storage requirer charm can leverage. None

class ObjectStorageRequirer

Description

Authentication configuration requirer class. None

Methods

ObjectStorageRequirer. __init__( self , charm , relation_name: str , bucket )

Constructs a requirer that consumes object storage.

Arguments

charm

CharmBase: the charm which manages this object.

relation_name

str: name of the relation in metadata.yaml that has the s3 interface.

refresh_event

an optional bound event which will be observed to re-set authentication configuration.

bucket

Optional[str]: bucket name to request on the endpoint. If not provided, {model.name}-{app.name} will be used.

Description

This class can be initialized as follows:

self.object_storage = ObjectStorageRequirer(
self,
bucket="some-app"
)

ObjectStorageRequirer. relation( self )

Description

The established Relation instance, or None if still unrelated. None

ObjectStorageRequirer. bucket_info( self )

Description

Indicate whether a remote bucket is available. None