juju / python-libjuju

Python library for the Juju API
Apache License 2.0
60 stars 100 forks source link

Can't deploy k8s bundles without series field #513

Closed DomFleischmann closed 3 years ago

DomFleischmann commented 3 years ago

When trying to deploy any bundle with kubernetes charms the deployment will fail with the following error:

Traceback (most recent call last):
  File "/home/dom/code/upgrade-test/tests/integration/test_upgrade_charm.py", line 14, in test_build_and_deploy
    await ops_test.model.deploy("local:bundle.yaml")
  File "/home/dom/code/upgrade-test/.tox/integration/lib/python3.8/site-packages/juju/model.py", line 1445, in deploy
    await handler.execute_plan()
  File "/home/dom/code/upgrade-test/.tox/integration/lib/python3.8/site-packages/juju/bundle.py", line 167, in execute_plan
    self.references[step.id_] = await change.run(self)
  File "/home/dom/code/upgrade-test/.tox/integration/lib/python3.8/site-packages/juju/bundle.py", line 353, in run
    await context.model._deploy(
  File "/home/dom/code/upgrade-test/.tox/integration/lib/python3.8/site-packages/juju/model.py", line 1654, in _deploy
    result = await app_facade.Deploy(applications=[app])
  File "/home/dom/code/upgrade-test/.tox/integration/lib/python3.8/site-packages/juju/client/facade.py", line 480, in wrapper
    reply = await f(*args, **kwargs)
  File "/home/dom/code/upgrade-test/.tox/integration/lib/python3.8/site-packages/juju/client/_client13.py", line 1102, in Deploy
    reply = await self.rpc(msg)
  File "/home/dom/code/upgrade-test/.tox/integration/lib/python3.8/site-packages/juju/client/facade.py", line 623, in rpc
    result = await self.connection.rpc(msg, encoder=TypeEncoder)
  File "/home/dom/code/upgrade-test/.tox/integration/lib/python3.8/site-packages/juju/client/connection.py", line 512, in rpc
    raise errors.JujuError(err_results)
juju.errors.JujuError: ['cannot add application "argo-controller": series is empty']

When adding series: kubernetes in each charm section the deployment is successful:

applications:
  argo-controller:
    charm: cs:argo-controller
    source: ./operators/argo-controller
    scale: 1
    **series: kubernetes**
SimonRichardson commented 3 years ago

If you changed the bundle to be kubernetes and removed the series does it work then?

bundle: kubernetes
applications:
   ...
DomFleischmann commented 3 years ago

@SimonRichardson all of this was tested with the bundle: kubernetes field in the bundle.

@johnsca and I took a deeper look yesterday and suspect the issue is in this code section: https://github.com/juju/python-libjuju/blob/888257a6560c7313d78b1eb365c02dbe0e79a6e3/juju/bundle.py#L290-L317

There the controller is creating an AddApplicationChange but is not populating the series field correctly. What we can do is check if it is set in libjuju and set it ourselves if it is not. But the initial issue seems to be outside of libjuju and might require an additional bug.

SimonRichardson commented 3 years ago

Essentially we need to replicate this https://github.com/juju/bundlechanges/pull/85

But the initial issue seems to be outside of libjuju and might require an additional bug.

This was a known breaking change to get 2.9 out.