Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bundles with overlays #566

Merged
merged 8 commits into from
Nov 8, 2021
Merged

Bundles with overlays #566

merged 8 commits into from
Nov 8, 2021

Conversation

cderici
Copy link
Contributor

@cderici cderici commented Oct 22, 2021

Description

This PR adds the support for overlays in bundle deployments.

Fixes #510

This PR relies on a change in Juju's api for getting changes for bundles with overlays (multi-part yaml support), juju/juju#13448.

Jira card #142

QA Steps

tests/integration/test_model.py includes some new tests for the added support.

tox -e integration -- tests/integration/test_model.py

Notes & Discussion

Please do not merge yet, as a couple of small things need to be done/added for this to be ready to land:

  • Add a PR on Juju for GetChange add multi-part yaml support to GetChanges for the bundle facade juju#13448
  • Land that PR on Juju
  • Charmstore bundles with --overlay argument, along with its test
  • A test for a multi-part overlay as an --overlay argument to a local bundle being deployed
  • A test for a multi-part overlay as an --overlay argument to a charmstore bundle being deployed
  • Make sure that we resolve and inline config: include-file:// and config: include-base64:// here in pylibjuju side

@cderici
Copy link
Contributor Author

cderici commented Oct 22, 2021

@cderici
Copy link
Contributor Author

cderici commented Oct 28, 2021

!!build!!

@cderici cderici force-pushed the bundles-with-overlays branch from d54f56a to d4bc0f2 Compare November 4, 2021 14:19
jujubot added a commit to juju/juju that referenced this pull request Nov 4, 2021
…i-yaml

#13448

### Description

`pylibjuju` uses the bundle facade to get the changes for a bundle to be deployed. However, currently the `GetChanges` function that the facade uses only handles single-part yaml files, so this PR adds the support for multi-part yaml handling (which the Juju cli uses) to enable the use of overlays in bundles.

### QA steps

```sh
 $ cd juju/apiserver/facades/client/bundle/
 $ go test -gocheck.f TestGetChangesWithOverlaysV6
 $ go test -gocheck.f TestGetChangesWithOverlaysV1_5
```

### Notes & Discussion

This PR is needed for juju/python-libjuju#566, which adds the support for overlays in deploying bundles.
@cderici cderici removed the hint/do-not-merge requires additional efforts, no merge label Nov 4, 2021
juju/bundle.py Outdated
@@ -152,14 +156,63 @@ async def _handle_local_charms(self, bundle, bundle_dir):
app_name,
charm_url,
utils.get_local_charm_metadata(charm_dir),
resources=bundle["applications"][app_name].get("resources", {}),
resources=bundle.get('applications', bundle.get('services', {}))[app_name].get("resources", {}),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Services are dead to us, we shouldn't introduce deprecated functionality.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm pretty sure I added that because a bundle had 'services' but not 'applications', but maybe it was because of the facade versions etc.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah turns out I copy/pasted some old bundles to make new test bundles and introduced them myself, I updated all of them, running local tests right now, gonna push the patch soon 👍

juju/bundle.py Outdated

"""
bundle_apps = [self.bundle.get('applications', self.bundle.get('services', {}))]
overlay_apps = [overlay.get('applications', self.bundle.get('services', {})) for overlay in self.overlays]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above, remove services.

@@ -0,0 +1,15 @@
series: xenial
services:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

☝️

@cderici
Copy link
Contributor Author

cderici commented Nov 5, 2021

Note for the CI fails: The tests included in this PR are expected to fail in the CI because this PR depends on that PR on Juju which is landed, but not in the release yet, and the CI tests don't use the HEAD of Juju, it snap installs it.

@cderici cderici force-pushed the bundles-with-overlays branch from 490030c to 33f3f37 Compare November 8, 2021 17:33
@cderici
Copy link
Contributor Author

cderici commented Nov 8, 2021

$$merge$$

@jujubot jujubot merged commit 7b5145c into juju:master Nov 8, 2021
jujubot added a commit that referenced this pull request Dec 4, 2021
#599

2.9.5
^^^^^

Friday December 3 2021

* remove the event loop arguments by @cderici in #560
* add debug-log by @cderici in #562
* Model status by @juanmanuel-tirado in #563
* Pin cffi version to 1.14.6 for Python 3.5 by @cderici in #570
* Wait for applications to terminate on model reset by @balbirthomas in #572
* Babysitting python3.5 by @cderici in #571
* Deploy charmhub bundles by @cderici in #569
* Facade schemas for 2.9.17 by @SimonRichardson in #579
* Bundles with overlays by @cderici in #566
* Consistently getting a unit's public address by @cderici in #573
* [JUJU-158] Add python3.9 to setup.py by @cderici in #585
* [JUJU-157] Add note for removing services by @cderici in #583
* Added boolean entries to normalize values. by @juanmanuel-tirado in #582
* [JUJU-138] Streamlining asyncio tasks/events by @cderici in #580
* [JUJU-234] Fix for small bug in task handling by @cderici in #589
* Ensure all watchers validate for the Id by @SimonRichardson in #592
* [JUJU-276] Facade schemas for 2.9.19 by @cderici in #594
* [JUJU-238] Small bug fix for old ClientFacade support by @cderici in #593
* [JUJU-239] Debug-log parameters by @cderici in #595
* [JUJU-213] Local type `file` resource support by @cderici in #590
* [JUJU-289] Use provided series in deploy if supported by @jack-w-shaw in #596
* [JUJU-292] Update the charms in the tests to use Charmhub by @cderici in #597
* Legacy "services" for describing "applications" within bundles are no longer supported. "applications" can be used as a direct replacement for "services" in bundles.yaml.
* The websocket (ws) in a Connection object became a read-only property.


[JUJU-293] 

[JUJU-158]: https://warthogs.atlassian.net/browse/JUJU-158?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
@cderici cderici deleted the bundles-with-overlays branch February 16, 2022 18:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

deploy bundle with overlays
3 participants