Istio Beacon

  • Canonical Observability
Channel Revision Published Runs on
latest/edge 13 19 Nov 2024
Ubuntu 22.04
juju deploy istio-beacon-k8s --channel edge
Show information

Platform:

Ubuntu
22.04

charms.istio_beacon_k8s.v0.service_mesh

#Service Mesh Library.

The service mesh library is used to facilitate adding your charmed application to a service mesh. The library leverages the service_mesh and cross_model_mesh interfaces.

To add service mesh support to your charm, instantiate a ServiceMeshConsumer object in the __init__ method of your charm:

from charms.istio_beacon_k8s.v0.service_mesh import Policy, ServiceMeshConsumer

...
try:
    self._mesh = ServiceMeshConsumer(
        self,
        policies=[
            Policy(
                relation="logging",
                endpoints=[
                    Endpoint(
                        hosts=[self._my_host_name],
                        ports=[HTTP_LISTEN_PORT],
                        methods=["GET"],
                        paths=["/foo"],
                    ),
                ],
                service=self._my_k8s_service(),
            ),
        ],
    )
except ops.TooManyRelatedAppsError as e:
    self.unit.status = BlockedStatus(e)

class Method

Description

HTTP method. None

class Endpoint

Description

Data type for a policy endpoint. None

class Policy

Description

Data type for holding a service mesh policy. None

class ServiceMeshConsumer

Description

Class used for joining a service mesh. None

Methods

ServiceMeshConsumer. __init__( self , charm: CharmBase , mesh_relation_name: str , policies )

Class used for joining a service mesh.

Arguments

charm

The charm instantiating this object.

mesh_relation_name

The relation name as defined in metadata.yaml or charmcraft.yaml for the relation which used the service_mesh interface.

policies

List of access policies this charm supports.

ServiceMeshConsumer. update_service_mesh( self )

Update the service mesh.

Description

Gathers information from all relations of the charm and updates the mesh appropriately to allow communication.