Пример #1
0
def _as_artifact_and_pkg(variant_prefix, filename, bundle: Tuple):
    cloudformation, results = bundle
    yield _as_cf_artifact("{}{}".format(variant_prefix, filename),
                          cloudformation)
    yield {
        'packages': util.cluster_to_extra_packages(results.cluster_packages)
    }
Пример #2
0
def make_template(num_masters, gen_arguments, varietal, bootstrap_variant_prefix):
    '''
    Return a tuple: the generated template for num_masters and the artifact dict.

    @param num_masters: int, number of master nodes to embed in the generated template
    @param gen_arguments: dict, args to pass to the gen library. These are user
                          input arguments which get filled in/prompted for.
    @param varietal: string, indicate template varietal to build for either 'acs' or 'dcos'
    '''

    master_list_source = Source()
    master_list_source.add_must('master_list', master_list_arm_json(num_masters, varietal))

    if varietal == 'dcos':
        dcos_template = gen_templates(
            gen_arguments,
            'azuredeploy',
            extra_sources=[master_list_source, azure_dcos_source])
    elif varietal == 'acs':
        dcos_template = gen_templates(
            gen_arguments,
            'acs',
            extra_sources=[master_list_source, azure_acs_source])
    else:
        raise ValueError("Unknown Azure varietal specified")

    yield {'packages': util.cluster_to_extra_packages(dcos_template['results'].cluster_packages)}
    yield {
        'channel_path': 'azure/{}{}-{}master.azuredeploy.json'.format(bootstrap_variant_prefix, varietal, num_masters),
        'local_content': dcos_template['arm'],
        'content_type': 'application/json; charset=utf-8'
    }
Пример #3
0
def make_template(num_masters, gen_arguments, varietal, bootstrap_variant_prefix):
    '''
    Return a tuple: the generated template for num_masters and the artifact dict.

    @param num_masters: int, number of master nodes to embed in the generated template
    @param gen_arguments: dict, args to pass to the gen library. These are user
                          input arguments which get filled in/prompted for.
    @param varietal: string, indicate template varietal to build for either 'acs' or 'dcos'
    '''

    master_list_source = Source()
    master_list_source.add_must('master_list', Late(master_list_arm_json(num_masters, varietal)))
    master_list_source.add_must('num_masters', str(num_masters))

    if varietal == 'dcos':
        arm, results = gen_templates(
            gen_arguments,
            'azuredeploy',
            extra_sources=[master_list_source, azure_dcos_source])
    elif varietal == 'acs':
        arm, results = gen_templates(
            gen_arguments,
            'acs',
            extra_sources=[master_list_source, azure_acs_source])
    else:
        raise ValueError("Unknown Azure varietal specified")

    yield {'packages': util.cluster_to_extra_packages(results.cluster_packages)}
    yield {
        'channel_path': 'azure/{}{}-{}master.azuredeploy.json'.format(bootstrap_variant_prefix, varietal, num_masters),
        'local_content': arm,
        'content_type': 'application/json; charset=utf-8'
    }
Пример #4
0
def _as_artifact_and_pkg(variant_prefix, filename, gen_out):
    yield _as_cf_artifact("{}{}".format(variant_prefix, filename),
                          gen_out.cloudformation)
    yield {
        'packages':
        util.cluster_to_extra_packages(gen_out.results.cluster_packages)
    }
Пример #5
0
def make_template(num_masters, gen_arguments, varietal,
                  bootstrap_variant_prefix):
    '''
    Return a tuple: the generated template for num_masters and the artifact dict.

    @param num_masters: int, number of master nodes to embed in the generated template
    @param gen_arguments: dict, args to pass to the gen library. These are user
                          input arguments which get filled in/prompted for.
    @param varietal: string, indicate template varietal to build for either 'acs' or 'dcos'
    '''

    gen_arguments['master_list'] = master_list_arm_json(num_masters, varietal)
    args = deepcopy(gen_arguments)

    if varietal == 'dcos':
        args['exhibitor_azure_prefix'] = "[[[variables('uniqueName')]]]"
        args[
            'exhibitor_azure_account_name'] = "[[[variables('storageAccountName')]]]"
        args['exhibitor_azure_account_key'] = (
            "[[[listKeys(resourceId('Microsoft.Storage/storageAccounts', "
            "variables('storageAccountName')), '2015-05-01-preview').key1]]]")
        args['cluster_name'] = "[[[variables('uniqueName')]]]"
        dcos_template = gen_templates(args, 'azuredeploy')
    elif varietal == 'acs':
        args[
            'exhibitor_azure_prefix'] = "[[[variables('masterPublicIPAddressName')]]]"
        args[
            'exhibitor_azure_account_name'] = "[[[variables('masterStorageAccountExhibitorName')]]]"
        args['exhibitor_azure_account_key'] = (
            "[[[listKeys(resourceId('Microsoft.Storage/storageAccounts', "
            "variables('masterStorageAccountExhibitorName')), '2015-06-15').key1]]]"
        )
        args['cluster_name'] = "[[[variables('masterPublicIPAddressName')]]]"
        args['bootstrap_tmp_dir'] = "/var/tmp"
        dcos_template = gen_templates(args, 'acs')
    else:
        raise ValueError("Unknown Azure varietal specified")

    yield {
        'packages':
        util.cluster_to_extra_packages(dcos_template.results.cluster_packages)
    }
    yield {
        'channel_path':
        'azure/{}{}-{}master.azuredeploy.json'.format(bootstrap_variant_prefix,
                                                      varietal, num_masters),
        'local_content':
        dcos_template.arm,
        'content_type':
        'application/json; charset=utf-8'
    }
Пример #6
0
def _as_artifact_and_pkg(variant_prefix, filename, bundle: Tuple):
    cloudformation, results = bundle
    yield _as_cf_artifact("{}{}".format(variant_prefix, filename), cloudformation)
    yield {'packages': util.cluster_to_extra_packages(results.cluster_packages)}