Skip to content

Commit

Permalink
Ensure that the lead control-plane unit allocates a cos-token for itself
Browse files Browse the repository at this point in the history
  • Loading branch information
addyess committed Aug 29, 2024
1 parent 673a306 commit b5f91be
Show file tree
Hide file tree
Showing 4 changed files with 194 additions and 105 deletions.
12 changes: 10 additions & 2 deletions charms/worker/k8s/src/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,10 +448,18 @@ def _create_cos_tokens(self):

log.info("Prepare cos tokens")
if rel := self.model.get_relation("cos-tokens"):
self.distributor.allocate_tokens(relation=rel, token_strategy=TokenStrategy.COS)
self.distributor.allocate_tokens(
relation=rel,
token_strategy=TokenStrategy.COS,
token_type=ClusterTokenType.CONTROL_PLANE,
)

if rel := self.model.get_relation("cos-worker-tokens"):
self.distributor.allocate_tokens(relation=rel, token_strategy=TokenStrategy.COS)
self.distributor.allocate_tokens(
relation=rel,
token_strategy=TokenStrategy.COS,
token_type=ClusterTokenType.WORKER,
)

@on_error(
WaitingStatus("Waiting to enable features"),
Expand Down
Loading

0 comments on commit b5f91be

Please sign in to comment.