Cluster name has a stray "\n" character, messing up dashboard queries
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Kubernetes Control Plane Charm |
Fix Released
|
High
|
Kevin W Monroe |
Bug Description
It seems that the generated cluster name may contain and end-of-line character:
https:/
Not sure how it could happen, but on grafana we can clearly see this:
"labels": {
"job": "kube-state-
Also see screenshot.
This can be confirmed by querying prometheus directly:
$ curl 10.1.199.
{"status"
Reproducer is available here: https:/
Changed in charm-kubernetes-master: | |
milestone: | none → 1.29+ck1 |
Changed in charm-kubernetes-master: | |
status: | New → In Progress |
importance: | Undecided → High |
assignee: | nobody → Kevin W Monroe (kwmonroe) |
Changed in charm-kubernetes-master: | |
milestone: | 1.29+ck1 → 1.29+ck2 |
Changed in charm-kubernetes-master: | |
status: | Fix Committed → Fix Released |
I see no way of actually generating a LF or CR.
the method to create the clustername is
``` (length= 32):
def token_generator
"""Generate a random token for use in account tokens.
param: length - the length of the token to generate ascii_letters + string.digits random. SystemRandom( ).choice( alpha) for _ in range(length))
"""
alpha = string.
token = "".join(
return token
```
which limits the cluster name to be alphanumerics. After this call a further winnowing is done to push to lowercase.
Its more likely this comes from the upgrade where the cluster was stored in leader_set.
we should strip the output from leader_get here
https:/ /github. com/charmed- kubernetes/ charm-kubernete s-control- plane/blob/ da2725c67c44bcc 855de166fc3251c 28879498dd/ src/charm. py#L409- L410