Deploy rook-ceph cluster tasks: - kubeadm: - rook: branch: wip-foo spec: mon: count: 1 The spec item is deep-merged against the cluster.yaml. The branch, sha1, or image items are used to determine the Ceph container imag
(ctx, config)
| 578 | |
| 579 | @contextlib.contextmanager |
| 580 | def task(ctx, config): |
| 581 | """ |
| 582 | Deploy rook-ceph cluster |
| 583 | |
| 584 | tasks: |
| 585 | - kubeadm: |
| 586 | - rook: |
| 587 | branch: wip-foo |
| 588 | spec: |
| 589 | mon: |
| 590 | count: 1 |
| 591 | |
| 592 | The spec item is deep-merged against the cluster.yaml. The branch, sha1, or |
| 593 | image items are used to determine the Ceph container image. |
| 594 | """ |
| 595 | if not config: |
| 596 | config = {} |
| 597 | assert isinstance(config, dict), \ |
| 598 | "task only supports a dictionary for configuration" |
| 599 | |
| 600 | log.info('Rook start') |
| 601 | |
| 602 | overrides = ctx.config.get('overrides', {}) |
| 603 | teuthology.deep_merge(config, overrides.get('ceph', {})) |
| 604 | teuthology.deep_merge(config, overrides.get('rook', {})) |
| 605 | log.info('Config: ' + str(config)) |
| 606 | |
| 607 | # set up cluster context |
| 608 | if not hasattr(ctx, 'rook'): |
| 609 | ctx.rook = {} |
| 610 | if 'cluster' not in config: |
| 611 | config['cluster'] = 'ceph' |
| 612 | cluster_name = config['cluster'] |
| 613 | if cluster_name not in ctx.rook: |
| 614 | ctx.rook[cluster_name] = argparse.Namespace() |
| 615 | |
| 616 | ctx.rook[cluster_name].remote = list(ctx.cluster.remotes.keys())[0] |
| 617 | |
| 618 | # image |
| 619 | teuth_defaults = teuth_config.get('defaults', {}) |
| 620 | cephadm_defaults = teuth_defaults.get('cephadm', {}) |
| 621 | containers_defaults = cephadm_defaults.get('containers', {}) |
| 622 | container_image_name = containers_defaults.get('image', None) |
| 623 | if 'image' in config: |
| 624 | ctx.rook[cluster_name].image = config.get('image') |
| 625 | else: |
| 626 | sha1 = config.get('sha1') |
| 627 | flavor = config.get('flavor', 'default') |
| 628 | if sha1: |
| 629 | if flavor == "crimson-debug" or flavor == "crimson-release": |
| 630 | ctx.rook[cluster_name].image = container_image_name + ':' + sha1 + '-' + flavor |
| 631 | else: |
| 632 | ctx.rook[cluster_name].image = container_image_name + ':' + sha1 |
| 633 | else: |
| 634 | # hmm, fall back to branch? |
| 635 | branch = config.get('branch', 'master') |
| 636 | ctx.rook[cluster_name].image = container_image_name + ':' + branch |
| 637 | log.info('Ceph image is %s' % ctx.rook[cluster_name].image) |
nothing calls this directly
no test coverage detected