diff --git a/src/charm.py b/src/charm.py index dbe9ccc1..14807758 100755 --- a/src/charm.py +++ b/src/charm.py @@ -34,7 +34,7 @@ log = logging.getLogger(__name__) -OBSERVABILITY_USER = OBSERVABILITY_ROLE = "system:cos-monitoring-control-plane" +OBSERVABILITY_ROLE = "system:cos" JobConfig = namedtuple("JobConfig", ["name", "metrics_path", "scheme", "target"]) @@ -316,8 +316,9 @@ def configure_observability(self): if self.unit.is_leader(): kubectl("apply", "-f", "templates/observability.yaml") # Issue a token for metrics scraping + cos_user = f"system:cos:{kubernetes_snaps.get_node_name()}" auth_webhook.create_token( - uid=self.model.unit.name, username=OBSERVABILITY_USER, groups=[OBSERVABILITY_ROLE] + uid=self.model.unit.name, username=cos_user, groups=[OBSERVABILITY_ROLE] ) def generate_tokens(self):