if machine has 'Inst id' with capitals, deploy fails

Bug #1858846 reported by Hans van den Bogert
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Calico Charm
Triaged
Medium
Unassigned

Bug Description

I looked into this after seeing that the calico charm does not successfully deploy and gets stuck in state "retry calico configuration"

Further investigation showed:

```
unit-calico-23: 16:47:40 INFO unit.calico/23.juju-log etcd:36: Traceback (most recent call last):
  File "/var/lib/juju/agents/unit-calico-23/charm/reactive/calico.py", line 465, in configure_node
    node = calicoctl_get('node', node_name)
  File "/var/lib/juju/agents/unit-calico-23/charm/reactive/calico.py", line 633, in calicoctl_get
    output = calicoctl(*args)
  File "/var/lib/juju/agents/unit-calico-23/charm/reactive/calico.py", line 582, in calicoctl
subprocess.CalledProcessError: Command '['/opt/calicoctl/calicoctl', 'get', '-o', 'yaml', '--export', 'node', 'NLDW1-6-26-1']' returned non-zero exit status 1

```

Manually adding the node shows the supposed faulty scenario; Adding a node on calico level fails if it has capitals.

```
./calicoctl create -f me.yaml
Failed to create 'Node' resource: [error with field Metadata.Name = 'NLDW1-6-26-1' (name must consist of lower case alphanumeric characters, '-' or '.' (regex: [a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*))]
```

Changing the node's name in MAAS to lower case solved this for me.

Tags: cdo-qa
description: updated
Revision history for this message
George Kraft (cynerva) wrote :

Thanks for the report. Looks like the calico charm uses gethostname() in a few places to determine the node name, where it should be using gethostname().lower().

Changed in charm-calico:
status: New → Confirmed
George Kraft (cynerva)
Changed in charm-calico:
importance: Undecided → Medium
status: Confirmed → Triaged
Revision history for this message
Peter Jose De Sousa (pjds) wrote :

hit this one today, calico adds the node as lower, but upper will be used to fetch the node with calicoctl, failing

tags: added: cdo-qa
Revision history for this message
Ebrar Leblebici (birru2) wrote :

I also hit this one with calico charm from 1.28/stable channel and rev 101.

Revision history for this message
Michael Fischer (michaelandrewfischer) wrote (last edit ):

I see this regardless of capitalization in 1.29/stable revision 105
Using MAAS with lxd kvm host
juju version is 3.5.0

unit-calico-2: 01:17:33 ERROR unit.calico/2.juju-log b'resource does not exist: Node(pure-fox) with error: <nil>\n'
unit-calico-2: 01:17:33 ERROR unit.calico/2.juju-log b'null\n'
unit-calico-2: 01:17:33 ERROR unit.calico/2.juju-log Failed to configure node.
Traceback (most recent call last):
  File "/var/lib/juju/agents/unit-calico-2/charm/./src/charm.py", line 298, in _configure_node
    node = self._calicoctl_get("node", node_name)
  File "/var/lib/juju/agents/unit-calico-2/charm/./src/charm.py", line 640, in _calicoctl_get
    output = self.calicoctl(*args)
  File "/var/lib/juju/agents/unit-calico-2/charm/./src/charm.py", line 632, in calicoctl
    return subprocess.check_output(cmd, env=env, stderr=subprocess.PIPE, timeout=timeout)
  File "/usr/lib/python3.10/subprocess.py", line 421, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/usr/lib/python3.10/subprocess.py", line 526, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/opt/calicoctl/calicoctl', 'get', '-o', 'yaml', '--export', 'node', 'pure-fox']' returned non-zero exit status 1.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.