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

Export bundle with SAAS block #10408

Merged
merged 2 commits into from Jul 1, 2019

Conversation

SimonRichardson
Copy link
Member

Description of change

The following just exports remote applications (SAAS) in the export
bundle command, if you've got a SAAS offering setup.

QA steps

Setup and deploy mysql

juju bootstrap lxd test
juju deploy mysql
juju offer mysql:db
juju status --relations

Create a new model and export the bundle

juju add-model other
juju deploy wordpress
juju add-relation wordpress:db admin/default.mysql
juju export-bundle

The following should export the SAAS block with mysql in it.

series: trusty
saas:
  mysql:
    url: test:admin/default.mysql
applications:
  wordpress:
    charm: cs:trusty/wordpress-5
    num_units: 1
    to:
    - "0"
machines:
  "0": {}
relations:
- - wordpress:db
  - mysql:db

Documentation changes

Export bundle now includes a SAAS block if you've set on up.

The following just exports remote applications (SAAS) in the export
bundle command.
@SimonRichardson
Copy link
Member Author

As we've not released this yet it should be behind a feature flag.
Copy link
Contributor

@achilleasa achilleasa left a comment

Choose a reason for hiding this comment

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

LGTM.

QA ok for local -> local controllers.
When exporting an offer consumed from a remote controller the exported-bundle correctly includes the controller prefix.

@SimonRichardson
Copy link
Member Author

$$merge$$

@jujubot jujubot merged commit 1926ee4 into juju:develop Jul 1, 2019
@SimonRichardson SimonRichardson deleted the export-bundle-with-saas branch July 1, 2019 13:27
achilleasa added a commit to achilleasa/juju that referenced this pull request Jul 31, 2019
jujubot added a commit that referenced this pull request Jul 31, 2019
#10473

This PR first reverts the cmr for bundles changes (#10408, #10410) that landed on develop and then merges the current 2.6 HEAD which has all the cmr for bundles changes removed via #10474.

This ensures that both 2.6 and develop do not contain any bundle-related changes and allows us to create a separate clean PR to re-introduce the changes just to develop.
jujubot added a commit that referenced this pull request Aug 2, 2019
#10476

## Description of change

This PR composes the changes of the following PRs that implement the server and client-side bits for supporting offers/saas blocks in bundles as well as the changes for multi-document bundles (a bundle that contains additional overlay documents following the base bundle):

Originally landed on **2.6**:
- include offers in exported bundles #10353
- apply create offer changes when deploying bundles #10356
- include offer acl in export bundle output #10380
- consume offer #10382
- apply grant offer access changes when deploying bundles #10394
- support for multi-doc bundles and overlays #10460

Originally landed on **develop**:
- export bundle with SAAS block #10408 
- deploy a SAAS from another local controller #10410

All of the above changes where removed from 2.6 (via #10474) and develop (via #10473) so they can be re-introduced just on develop in order to avoid the risk of shipping potential bugs in a 2.6.x release. 

## QA steps

### Expose offers

```console
$ export JUJU_DEV_FEATURE_FLAGS=bundle-cmr
$ juju bootstrap lxd test --no-gui

# Deploy a bundle with an offer
$ juju add-user bar
$ juju deploy ./testcharms/charm-repo/bundle/apache2-with-offers
Resolving charm: cs:apache2-26
Executing changes:
- upload charm cs:apache2-26 for series bionic
- deploy application apache2 on bionic using cs:apache2-26
- create offer my-offer using apache2:apache-website,website-cache
- grant user admin admin access to offer my-offer
- grant user bar consume access to offer my-offer
- create offer my-other-offer using apache2:apache-website
Deploy of bundle completed.

# Verify that export-bundle generates a multi-doc bundle
$ juju export-bundle
series: bionic
applications:
 apache2:
 charm: cs:apache2-26
--- # overlay.yaml
applications:
 apache2:
 offers:
 my-offer:
 endpoints:
 - apache-website
 - website-cache
 acl:
 admin: admin
 bar: consume
 my-other-offer:
 endpoints:
 - apache-website
 acl:
 admin: admin

# Deploy another bundle with overlays
$ juju add-model test1

$ less testcharms/charm-repo/bundle/multi-doc-overlays/bundle.yaml
series: trusty
applications:
 apache2:
 charm: cs:apache2-26
 num_units: 1
--- # overlay 1
applications:
 apache2:
 offers:
 my-offer:
 endpoints:
 - apache-website
 acl:
 admin: admin
--- # overlay 2
applications:
 wordpress:
 charm: cs:trusty/wordpress-5
 num_units: 1

$ echo -n 'my-include' > example.txt
$ cat > overlay.yaml << EOT
applications:
 wordpress:
 annotations:
 raw: include-file://example.txt
 enc: include-base64://example.txt
EOT

$ juju deploy ./testcharms/charm-repo/bundle/multi-doc-overlays --overlay overlay.yaml
Resolving charm: cs:apache2-26
Resolving charm: cs:trusty/wordpress-5
Executing changes:
- upload charm cs:apache2-26 for series trusty
- deploy application apache2 on trusty using cs:apache2-26
- upload charm cs:trusty/wordpress-5 for series trusty
- deploy application wordpress on trusty using cs:trusty/wordpress-5
- set annotations for wordpress
- create offer my-offer using apache2:apache-website
- grant user admin admin access to offer my-offer
- add unit apache2/0 to new machine 0
- add unit wordpress/0 to new machine 1
Deploy of bundle completed.

$ juju export-bundle
series: trusty
applications:
 apache2:
 charm: cs:apache2-26
 num_units: 1
 to:
 - "0"
 wordpress:
 charm: cs:trusty/wordpress-5
 num_units: 1
 to:
 - "1"
 annotations:
 enc: bXktaW5jbHVkZQ==
 raw: my-include
machines:
 "0": {}
 "1": {}
--- # overlay.yaml
applications:
 apache2:
 offers:
 my-offer:
 endpoints:
 - apache-website
 acl:
 admin: admin
```

### Consume offers (SAAS blocks)

```console
export JUJU_DEV_FEATURE_FLAGS=bundle-cmr
juju bootstrap lxd test --no-gui

juju deploy mysql
juju status --relations

juju offer mysql:db
juju add-model other
juju switch other
juju deploy ./testcharms/charm-repo/bundle/wordpress-with-saas/bundle.yaml
```

```console
export JUJU_DEV_FEATURE_FLAGS=bundle-cmr
juju bootstrap lxd test
juju deploy mysql
juju offer mysql:db
juju status --relations

juju add-model other
juju deploy wordpress
juju add-relation wordpress:db admin/default.mysql
juju export-bundle --filename bundle.yaml
```

file content should:
```yaml
series: trusty
saas:
 mysql:
 url: test:admin/default.mysql
applications:
 wordpress:
 charm: cs:trusty/wordpress-5
 num_units: 1
 to:
 - "0"
machines:
 "0": {}
relations:
- - wordpress:db
 - mysql:db
```

Which you can then deploy
```console
juju bootstrap lxd other
juju deploy ./bundle.yaml
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants