1111from charmed_kubeflow_chisme .kubernetes import KubernetesResourceHandler
1212from charmed_kubeflow_chisme .lightkube .batch import delete_many
1313from charms .grafana_k8s .v0 .grafana_dashboard import GrafanaDashboardProvider
14- from charms .istio_beacon_k8s .v0 .service_mesh import ServiceMeshConsumer
14+ from charms .istio_beacon_k8s .v0 .service_mesh import AppPolicy , ServiceMeshConsumer , UnitPolicy
1515from charms .istio_ingress_k8s .v0 .istio_ingress_route import (
1616 BackendRef ,
1717 HTTPPathMatch ,
@@ -89,7 +89,7 @@ def __init__(self, *args):
8989 self ._container_name = "kubeflow-dashboard"
9090 self ._container = self .unit .get_container (self ._name )
9191 self ._configmap_name = self .model .config ["dashboard-configmap" ]
92- self ._port = self .model .config ["port" ]
92+ self ._port = int ( self .model .config ["port" ])
9393 self ._registration_flow = self .model .config ["registration-flow" ]
9494 self ._k8s_resource_handler = None
9595 self ._configmap_handler = None
@@ -109,7 +109,12 @@ def __init__(self, *args):
109109 self .service_patcher = KubernetesServicePatch (self , [port ])
110110
111111 # Ambient Mesh integration
112- self ._mesh = ServiceMeshConsumer (self )
112+ self ._mesh = ServiceMeshConsumer (
113+ self ,
114+ policies = [
115+ UnitPolicy (relation = "metrics-endpoint" , ports = [self ._port ]),
116+ ],
117+ )
113118 self .ingress = IstioIngressRouteRequirer (self , relation_name = "istio-ingress-route" )
114119 self ._ambient_mesh_ingress ()
115120
0 commit comments