Keystone K8S

  • By OpenStack Charmers
Channel Revision Published Runs on
yoga/beta 82 10 Mar 2023
Ubuntu 22.04
yoga/edge 99 16 May 2023
Ubuntu 22.04
xena/beta 72 21 Nov 2022
Ubuntu 22.04
xena/edge 76 20 Jan 2023
Ubuntu 22.04
2024.1/edge 172 28 Apr 2024
Ubuntu 22.04
2023.2/stable 148 06 Dec 2023
Ubuntu 22.04
2023.2/candidate 169 05 Apr 2024
Ubuntu 22.04
2023.2/beta 169 05 Apr 2024
Ubuntu 22.04
2023.2/edge 169 03 Apr 2024
Ubuntu 22.04
2023.1/stable 125 26 Sep 2023
Ubuntu 22.04
2023.1/candidate 155 12 Jan 2024
Ubuntu 22.04
2023.1/beta 155 10 Jan 2024
Ubuntu 22.04
2023.1/edge 155 03 Jan 2024
Ubuntu 22.04
juju deploy keystone-k8s --channel 2023.2/stable
Show information

Platform:

charms.keystone_k8s.v0.identity_resource

IdentityResourceProvides and Requires module.

This library contains the Requires and Provides classes for handling the identity_ops interface.

Import IdentityResourceRequires in your charm, with the charm object and the relation name: - self - "identity_ops"

Also provide additional parameters to the charm object: - request

Three events are also available to respond to: - provider_ready - provider_goneaway - response_avaialable

A basic example showing the usage of this relation follows:

from charms.keystone_k8s.v0.identity_resource import IdentityResourceRequires

class IdentityResourceClientCharm(CharmBase):
    def __init__(self, *args):
        super().__init__(*args)
        # IdentityResource Requires
        self.identity_resource = IdentityResourceRequires(
            self, "identity_ops",
        )
        self.framework.observe(
            self.identity_resource.on.provider_ready, self._on_identity_resource_ready)
        self.framework.observe(
            self.identity_resource.on.provider_goneaway, self._on_identity_resource_goneaway)
        self.framework.observe(
            self.identity_resource.on.response_available, self._on_identity_resource_response)

    def _on_identity_resource_ready(self, event):
        '''React to the IdentityResource provider_ready event.

        This event happens when n IdentityResource relation is added to the
        model. Ready to send any ops to keystone.
        '''
        # Ready to send any ops.
        pass

    def _on_identity_resource_response(self, event):
        '''React to the IdentityResource response_available event.

        The IdentityResource interface will provide the response for the ops sent.
        '''
        # Read the response for the ops sent.
        pass

    def _on_identity_resource_goneaway(self, event):
        '''React to the IdentityResource goneaway event.

        This event happens when an IdentityResource relation is removed.
        '''
        # IdentityResource Relation has goneaway. No ops can be sent.
        pass

A sample ops request can be of format { "id": "tag": "ops": [ { "name": , "params": { <param 1>: <value 1>, <param 2>: <value 2> } } ] }

For any sensitive data in the ops params, the charm can create secrets and pass secret id instead of sensitive data as part of ops request. The charm should ensure to grant secret access to provider charm i.e., keystone over relation. The secret content should hold the sensitive data with same name as param name.


class IdentityOpsProviderReadyEvent

Description

Has IdentityOpsProviderReady Event. None

class IdentityOpsResponseEvent

Description

Has IdentityOpsResponse Event. None

class IdentityOpsProviderGoneAwayEvent

Description

Has IdentityOpsProviderGoneAway Event. None

class IdentityResourceResponseEvents

Description

Events class for on. None

class IdentityResourceRequires

Description

IdentityResourceRequires class. None

Methods

IdentityResourceRequires. __init__( self , charm: CharmBase , relation_name: str )

IdentityResourceRequires. response( self )

Description

Response object from keystone. None

IdentityResourceRequires. save_request_in_store( self , id: str , tag: str , ops: list , state: int )

Description

Save request in the store. None

IdentityResourceRequires. get_request_from_store( self , id: str )

Description

Get request from the stote. None

IdentityResourceRequires. is_request_processed( self , id: str )

Description

Check if request is processed. None

IdentityResourceRequires. get_remote_app_data( self , key: str )

Description

Return the value for the given key from remote app data. None

IdentityResourceRequires. ready( self )

Interface is ready or not.

Description

Interface is considered ready if the op request is processed and response is sent. In case of non leader unit, just consider the interface is ready.

IdentityResourceRequires. request_ops( self , request: dict )

Description

Request keystone ops. None

class IdentityOpsRequestEvent

Description

Has IdentityOpsRequest Event. None

Methods

IdentityOpsRequestEvent. __init__( self , handle , relation_id , relation_name , request )

Description

Initialise event. None

IdentityOpsRequestEvent. snapshot( self )

Description

Snapshot the event. None

IdentityOpsRequestEvent. restore( self , snapshot )

Description

Restore the event. None

class IdentityResourceProviderEvents

Description

Events class for on. None

class IdentityResourceProvides

Description

IdentityResourceProvides class. None

Methods

IdentityResourceProvides. __init__( self , charm: CharmBase , relation_name: str )

IdentityResourceProvides. set_ops_response( self , relation_id: str , relation_name: str , ops_response: dict )

Description

Set response to ops request. None