cni manage_flags fails if no cni relations are present

Bug #1870809 reported by Kevin W Monroe
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Kubernetes Control Plane Charm
Fix Released
Undecided
Kevin W Monroe
Kubernetes Worker Charm
Fix Released
Undecided
Kevin W Monroe

Bug Description

We use goal-state to determine configuration for related CNI endpoints in interface-kubernetes-cni:

https://github.com/juju-solutions/interface-kubernetes-cni/commit/d5754e3f50a13e35b224842b6dae5dcae989cca0#diff-6e152090b45a29ed86305121942fb300R40

If no cni relations have been specified, we'll get a key error. We don't typically hit this because we deploy with bundles, which set up required relations at deploy time. However, deploying a k8s-[master|worker] charm by itself will fail. Repro:

juju deploy ~containers/kubernetes-master --constraints mem=4G --channel beta --config channel=1.18/beta

When manage_flags runs for the cni relation, we'll hit this:

...
unit-kmb-0: 10:42:35 INFO unit.kmb/0.juju-log Reactive main running for hook install
unit-kmb-0: 10:42:35 ERROR unit.kmb/0.juju-log Hook error:
Traceback (most recent call last):
  File "/var/lib/juju/agents/unit-kmb-0/.venv/lib/python3.6/site-packages/charms/reactive/__init__.py", line 73, in main
    hookenv._run_atstart()
  File "/var/lib/juju/agents/unit-kmb-0/.venv/lib/python3.6/site-packages/charmhelpers/core/hookenv.py", line 1312, in _run_atstart
    callback(*args, **kwargs)
  File "/var/lib/juju/agents/unit-kmb-0/.venv/lib/python3.6/site-packages/charms/reactive/endpoints.py", line 132, in _startup
    endpoint._manage_flags()
  File "/var/lib/juju/agents/unit-kmb-0/.venv/lib/python3.6/site-packages/charms/reactive/endpoints.py", line 251, in _manage_flags
    self.manage_flags()
  File "/var/lib/juju/agents/unit-kmb-0/charm/hooks/relations/kubernetes-cni/provides.py", line 13, in manage_flags
    self.config_available())
  File "/var/lib/juju/agents/unit-kmb-0/charm/hooks/relations/kubernetes-cni/provides.py", line 31, in config_available
    name for name in goal_state['relations'][self.endpoint_name]
KeyError: 'cni'
...

description: updated
Changed in charm-kubernetes-master:
assignee: nobody → Kevin W Monroe (kwmonroe)
Changed in charm-kubernetes-master:
status: New → In Progress
description: updated
summary: - cni manage_flags fails if no goal-state relations are present
+ cni manage_flags fails if no cni relations are present
Revision history for this message
Kevin W Monroe (kwmonroe) wrote :

This is fixed in interface-kubernetes-cni with the following:

https://github.com/juju-solutions/interface-kubernetes-cni/pull/8

tags: added: review-needed
Changed in charm-kubernetes-worker:
assignee: nobody → Kevin W Monroe (kwmonroe)
status: New → In Progress
description: updated
George Kraft (cynerva)
Changed in charm-kubernetes-master:
status: In Progress → Fix Committed
Changed in charm-kubernetes-worker:
status: In Progress → Fix Committed
tags: removed: review-needed
Changed in charm-kubernetes-master:
milestone: none → 1.19
Changed in charm-kubernetes-worker:
milestone: none → 1.19
Changed in charm-kubernetes-master:
milestone: 1.19 → 1.18+ck1
Changed in charm-kubernetes-worker:
milestone: 1.19 → 1.18+ck1
Revision history for this message
George Kraft (cynerva) wrote :
Changed in charm-kubernetes-master:
status: Fix Committed → Fix Released
Changed in charm-kubernetes-worker:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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