def create_cluster_parameters()

in infrastructure-provisioning/src/general/scripts/azure/dataengine-service_create.py [0:0]


def create_cluster_parameters(location, tags, cluster_version, cluster_login_username, password, master_instance_type,
                              worker_count, worker_instance_type, cluster_storage_account_name, cluster_storage_account_key,
                              cluster_container_name, public_key, vpc_id, subnet,
                              edge_storage_account_name, edge_storage_account_key, edge_container_name,
                              shared_storage_account_name, shared_storage_account_key, shared_container_name):

    # Returns cluster parameters

    return ClusterCreateParametersExtended(
        location=location,
        tags=tags,
        properties=ClusterCreateProperties(
            cluster_version=cluster_version,
            os_type=OSType.linux,
            tier=Tier.standard,
            cluster_definition=ClusterDefinition(
                kind="Spark",
                component_version=
                {
                    "Spark": "3.1"
                },
                configurations={
                    "gateway": {
                        "restAuthCredential.isEnabled": "true",
                        "restAuthCredential.username": cluster_login_username,
                        "restAuthCredential.password": password
                    }
                }
            ),
            compute_profile=ComputeProfile(
                roles=[
                    Role(
                        name="headnode",
                        target_instance_count=2,
                        hardware_profile=HardwareProfile(vm_size=master_instance_type),
                        os_profile=OsProfile(
                            linux_operating_system_profile=LinuxOperatingSystemProfile(
                                username=cluster_login_username,
                                ssh_profile={
                                    "publicKeys": [
                                        {"certificateData": public_key}
                                    ]
                                }
                            )
                        ),
                        virtual_network_profile=VirtualNetworkProfile(
                            id=vpc_id,
                            subnet=subnet
                        )
                    ),
                    Role(
                        name="workernode",
                        target_instance_count=int(worker_count),
                        hardware_profile=HardwareProfile(vm_size=worker_instance_type),
                        os_profile=OsProfile(
                            linux_operating_system_profile=LinuxOperatingSystemProfile(
                                username=cluster_login_username,
                                ssh_profile={
                                    "publicKeys": [
                                        {"certificateData": public_key}
                                    ]
                                }
                            )
                        ),
                        virtual_network_profile=VirtualNetworkProfile(
                            id=vpc_id,
                            subnet=subnet
                        )
                    ),
                    Role(
                        name="zookeepernode",
                        target_instance_count=3,
                        hardware_profile=HardwareProfile(vm_size="Standard_A2_v2"),
                        os_profile=OsProfile(
                            linux_operating_system_profile=LinuxOperatingSystemProfile(
                                username=cluster_login_username,
                                ssh_profile={
                                    "publicKeys": [
                                        {"certificateData": public_key}
                                    ]
                                }
                            )
                        ),
                        virtual_network_profile=VirtualNetworkProfile(
                            id=vpc_id,
                            subnet=subnet
                        )
                    )
                ]
            ),
            storage_profile=StorageProfile(
                storageaccounts=[
                    StorageAccount(
                        name=cluster_storage_account_name + ".blob.core.windows.net",
                        key=cluster_storage_account_key,
                        container=cluster_container_name.lower(),
                        is_default=True
                    ),
                    StorageAccount(
                        name=edge_storage_account_name + ".blob.core.windows.net",
                        key=edge_storage_account_key,
                        container=edge_container_name.lower()
                    ),
                    StorageAccount(
                        name=shared_storage_account_name + ".blob.core.windows.net",
                        key=shared_storage_account_key,
                        container=shared_container_name.lower()
                    )
                ]
            )
        )
    )