Grafana
- By Jose C. Massón
Channel | Version | Revision | Published | Runs on |
---|---|---|---|---|
latest/stable | 64 | 64 | 31 Jan 2023 | |
latest/candidate | 64 | 64 | 31 Jan 2023 | |
latest/beta | 64 | 64 | 31 Jan 2023 | |
latest/edge | 67 | 67 | 02 Feb 2023 | |
1.0/stable | 64 | 64 | 31 Jan 2023 | |
1.0/candidate | 64 | 64 | 31 Jan 2023 | |
1.0/beta | 64 | 64 | 31 Jan 2023 | |
1.0/edge | 64 | 64 | 31 Jan 2023 |
juju deploy grafana-k8s
You will need Juju 2.9 to be able to run this command. Learn how to upgrade to Juju 2.9.
Deploy Kubernetes operators easily with Juju, the Universal Operator Lifecycle Manager. Need a Kubernetes cluster? Install MicroK8s to create a full CNCF-certified Kubernetes system in under 60 seconds.
Platform:
charms.grafana_k8s.v0.grafana_auth
-
- Last updated 21 Nov 2022
- Revision Library version 0
grafana-auth library.
This library implements the grafana-auth relation interface, it contains the Requirer and Provider classes for handling the interface. With this library charms can to configure authentication to Grafana. The provider will set the authentication mode that it needs, and will pass the necessary configuration of that authentication mode. The requirer will consume the authentication configuration to authenticate to Grafana.
Getting Started
From a charm directory, fetch the library using charmcraft
:
charmcraft fetch-lib charms.grafana_k8s.v0.grafana_auth
You will also need to add the following library to the charm's requirements.txt
file:
- jsonschema
Provider charm
Example:
An example on how to use the AuthProvider with proxy mode using default configuration options.
The default arguments are:
charm : CharmBase
relation_name: str : grafana-auth
header_name: str : X-WEBAUTH-USER
header_property: str : username
auto_sign_up: bool : True
sync_ttl: int : None
whitelist: list[str] : None
headers: list[str] : None
headers_encoded: bool : None
enable_login_token: bool : None
from charms.grafana_k8s.v0.grafana_auth import GrafanaAuthProxyProvider
from ops.charm import CharmBase
class ExampleProviderCharm(CharmBase):
def __init__(self, *args):
super().__init__(*args)
...
self.grafana_auth_proxy_provider = GrafanaAuthProxyProvider(self)
self.framework.observe(
self.grafana_auth_proxy_provider.on.urls_available, self._on_urls_available
)
...
Values different than defaults must be set from the class constructor. The official documentation of Grafana provides further explanation on the values that can be assigned to the different variables. Example:
from charms.grafana_k8s.v0.grafana_auth import GrafanaAuthProxyProvider
from ops.charm import CharmBase
class ExampleProviderCharm(CharmBase):
def __init__(self, *args):
super().__init__(*args)
...
self.grafana_auth_proxy_provider = GrafanaAuthProxyProvider(
self,
header_property="email",
auto_sign_up=False,
whitelist=["localhost","canonical.com"],
)
self.framework.observe(
self.grafana_auth_proxy_provider.on.urls_available, self._on_urls_available
)
...
Requirer charm
Example: An example on how to use the auth requirer.
from charms.grafana_k8s.v0.grafana_auth import AuthRequirer
from ops.charm import CharmBase
class ExampleRequirerCharm(CharmBase):
def __init__(self, *args):
super().__init__(*args)
self.auth_requirer = AuthRequirer(
self,
auth_requirer=["https://example.com/"]
)
self.framework.observe(
self.auth_requirer.on.auth_conf_available, self._on_auth_conf_available
)
Index
def _type_convert_stored(obj)
Description
Convert Stored* to their appropriate types, recursively. None
class UrlsAvailableEvent
Description
Charm event triggered when provider charm extracts the urls from relation data. None
Methods
UrlsAvailableEvent. __init__( self , handle , urls: list , relation_id: int )
UrlsAvailableEvent. snapshot( self )
Description
UrlsAvailableEvent. restore( self , snapshot: dict )
Description
class AuthProviderCharmEvents
Description
List of events that the auth provider charm can leverage. None
class AuthProvider
Base class for authentication configuration provider classes.
Description
This class shouldn't be initialized, Its children classes define the authentication mode and configuration to be used.
Methods
AuthProvider. __init__( self , charm: CharmBase , relation_name: str , refresh_event )
AuthProvider. _set_auth_config_in_relation_data( self , event )
Handler triggered on relation joined and leader elected events.
Arguments
Returns
Description
AuthProvider. _get_urls_from_relation_data( self , event )
Handler triggered on relation changed and pebble_ready events.
Arguments
Returns
Description
AuthProvider. _validate_auth_config_json_schema( self )
Description
class AuthConfAvailableEvent
Description
Charm Event triggered when authentication config is ready. None
Methods
AuthConfAvailableEvent. __init__( self , handle , auth: dict , relation_id: int )
AuthConfAvailableEvent. snapshot( self )
Description
AuthConfAvailableEvent. restore( self , snapshot: dict )
Description
class AuthRequirerCharmEvents
Description
List of events that the auth requirer charm can leverage. None
class AuthRequirer
Description
Authentication configuration requirer class. None
Methods
AuthRequirer. __init__( self , charm , urls , relation_name: str , refresh_event )
Constructs an authentication requirer that consumes authentication configuration.
Arguments
Description
AuthRequirer. _set_urls_in_relation_data( self , event )
Handler triggered on relation joined events. Adds URL(s) to relation data.
Arguments
Returns
AuthRequirer. _get_auth_config_from_relation_data( self , event )
Handler triggered on relation changed and pebble_ready events.
Arguments
Returns
Description
class GrafanaAuthProxyProvider
Authentication configuration provider class.
Description
Provides proxy mode for authentication to Grafana.
Methods
GrafanaAuthProxyProvider. __init__( self , charm: CharmBase , relation_name: str , refresh_event , header_name: str , header_property: str , auto_sign_up: bool , sync_ttl , whitelist , headers , headers_encoded , enable_login_token )
Constructs GrafanaAuthProxyProvider.
Arguments
Returns
Description
GrafanaAuthProxyProvider. _validate_auth_config_json_schema( self )
Validates authentication configuration using json schemas.
Returns