Skip to content

Commit

Permalink
[Hilo] Onboard new extension. (#6926)
Browse files Browse the repository at this point in the history
* generate init.

* Update test cases and recordings

* Format code,

* Update test

* Update params

* Update params.

* Add info to CODEOWNER. Update help file.

* Update param summary and help file.

* Update params file.

* Add service name.

* Update three examples.

* Update examples.

* rename command group name.

* Update a test case.

* Update test

* Update test records.

* Add two examples.

* Update examples and add readme file.

* Update examples.

* Update a example

* Remove create_flink_job_property command.

* Remove flink-job-property command help and params.

---------

Co-authored-by: v-yuchenli <v-yuchenli@microsoft.com>
  • Loading branch information
yuc-Li and v-yuchenli authored Nov 14, 2023
1 parent 0912459 commit 4e30684
Show file tree
Hide file tree
Showing 55 changed files with 19,054 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -312,4 +312,7 @@

/src/site-recovery/ @calvinhzy

/src/hdinsightonaks/ @aim-for-better @yuc-Li

/src/network-analytics/ @pikanghosh1

8 changes: 8 additions & 0 deletions src/hdinsightonaks/HISTORY.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.. :changelog:
Release History
===============

1.0.0b1
++++++
* Initial release.
132 changes: 132 additions & 0 deletions src/hdinsightonaks/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
# Azure CLI Hdinsightonaks Extension #
This is an extension to Azure CLI to manage Hdinsightonaks resources.

## How to use ##

Install this extension using the below CLI command

```sh
az extension add --name hdinsightonaks
```

### Included Features ###

#### List a list of available cluster pool versions ####

```sh
az hdinsight-on-aks list-available-cluster-pool-version -l westus3
```

#### Get all hdinsightonaks available-cluster version ####

```sh
az hdinsight-on-aks list-available-cluster-version -l westus3
```

#### Check the availability of the cluster name ####

```sh
az hdinsight-on-aks check-name-availability -l westus3 \
--name cliclusterpool/clicluster \
--type Microsoft.HDInsight/clusterPools/clusters
```

#### Create a Trino cluster ####

```sh
$node-profile = az hdinsight-on-aks cluster node-profile create --count 5 --node-type Worker --vm-size Standard_D8d_v5
az hdinsight-on-aks cluster create -n clustername --cluster-pool-name \
clusterpoolname -g resourcesGroup -l westus3 --assigned-identity-object-id \
00000000-0000-0000-0000-000000000000 \
--assigned-identity-client-id 00000000-0000-0000-0000-000000000000 \
--authorization-user-id 00000000-0000-0000-0000-000000000000 \
--assigned-identity-id /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/PSGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/yourmsi \
--cluster-type Trino --cluster-version 1.0.6 --oss-version 0.410.0 \
--nodes $node-profile
```

#### Delete a cluster ####

```sh
az hdinsight-on-aks cluster delete -n testcluster --cluster-pool-name testpool -g RG
```

#### List the HDInsight cluster pools under a resource group ####

```sh
az hdinsight-on-aks cluster list --cluster-pool-name testpool -g RG
```

#### List the config dump of all services running in cluster ####

```sh
az hdinsight-on-aks cluster list-service-config --cluster-name testcluster --cluster-pool-name testpool -g RG
```

#### Resize an existing Cluster ####

```sh
az hdinsight-on-aks cluster resize --cluster-name testcluster --cluster-pool-name testpool -g RG -l westus3 --target-worker-node-count 6
```
#### Get a HDInsight cluster ####

```sh
az hdinsight-on-aks cluster show -n testcluster --cluster-pool-name testpool -g RG
```

#### Get the status of a cluster instance ####

```sh
az hdinsight-on-aks cluster show-instance-view --cluster-name testcluster --cluster-pool-name testpool -g RG
```

#### Update a cluster ####

```sh
az hdinsight-on-aks cluster update -n testpsspark --cluster-pool-name ps-test-pool \
-g yuchenPSGroup --service-configs-profiles @config.json
```

#### List jobs of HDInsight on AKS cluster ####

```sh
az hdinsight-on-aks cluster job list --cluster-name testcluster --cluster-pool-name testpool -g RG
```

#### Operations on jobs of HDInsight on AKS cluster ####

```sh
$jobProperty = az hdinsight-on-aks cluster flink-job create --action NEW --job-name job1 --entry-class com.microsoft.hilo.flink.job.streaming.SleepJob --job-jar-directory abfs://flinkjob@hilosa.dfs.core.windows.net/jars --flink-configuration '{\"parallelism\":\"1\"}' --args test --jar-name jarname --job-name test1
az hdinsight-on-aks cluster job run --cluster-name testcluster --cluster-pool-name testpool -g RG--flink-job $jobProperty
```

#### Create a cluster pool ####

```sh
az hdinsight-on-aks clusterpool create -g RG -n poolName -l westus3 --workernode-size Standard_E4s_v3
```

#### Delete a Cluster Pool ####

```sh
az hdinsight-on-aks clusterpool delete -g RG -n testcluster
```

#### List the list of Cluster Pools within a Subscription ####

```sh
az hdinsight-on-aks clusterpool list
```

#### Get a cluster pool ####

```sh
az hdinsight-on-aks clusterpool show -g RG -n testpool
```

#### Update a cluster pool ####

```sh
az hdinsight-on-aks clusterpool update -g RG -n testpool --enable-log-analytics \
--log-analytic-workspace-id "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/RG/providers/microsoft.operationalinsights/workspaces/yourworkspace"
```
42 changes: 42 additions & 0 deletions src/hdinsightonaks/azext_hdinsightonaks/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#
# Code generated by aaz-dev-tools
# --------------------------------------------------------------------------------------------

from azure.cli.core import AzCommandsLoader
from azext_hdinsightonaks._help import helps # pylint: disable=unused-import


class HdinsightonaksCommandsLoader(AzCommandsLoader):

def __init__(self, cli_ctx=None):
from azure.cli.core.commands import CliCommandType
custom_command_type = CliCommandType(
operations_tmpl='azext_hdinsightonaks.custom#{}')
super().__init__(cli_ctx=cli_ctx,
custom_command_type=custom_command_type)

def load_command_table(self, args):
from azext_hdinsightonaks.commands import load_command_table
from azure.cli.core.aaz import load_aaz_command_table
try:
from . import aaz
except ImportError:
aaz = None
if aaz:
load_aaz_command_table(
loader=self,
aaz_pkg_name=aaz.__name__,
args=args
)
load_command_table(self, args)
return self.command_table

def load_arguments(self, command):
from azext_hdinsightonaks._params import load_arguments
load_arguments(self, command)


COMMAND_LOADER_CLS = HdinsightonaksCommandsLoader
41 changes: 41 additions & 0 deletions src/hdinsightonaks/azext_hdinsightonaks/_help.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#
# Code generated by aaz-dev-tools
# --------------------------------------------------------------------------------------------

# pylint: disable=line-too-long
# pylint: disable=too-many-lines

from knack.help_files import helps # pylint: disable=unused-import

helps['hdinsight-on-aks cluster node-profile'] = """
type: group
short-summary: Manage compute node profile.
"""

helps['hdinsight-on-aks cluster node-profile create'] = """
type: command
short-summary: Create a node profile with SKU and worker count.
"""

helps['hdinsight-on-aks cluster trino-hive-catalog'] = """
type: group
short-summary: Manage hive catalog config.
"""

helps['hdinsight-on-aks cluster trino-hive-catalog create'] = """
type: command
short-summary: Create a hive catalog configured as a Trino cluster.
"""

helps['hdinsight-on-aks cluster secret'] = """
type: group
short-summary: Manage secret reference.
"""

helps['hdinsight-on-aks cluster secret create'] = """
type: command
short-summary: Create a reference to provide a secret to store the password for accessing the database.
"""
40 changes: 40 additions & 0 deletions src/hdinsightonaks/azext_hdinsightonaks/_params.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#
# Code generated by aaz-dev-tools
# --------------------------------------------------------------------------------------------

# pylint: disable=too-many-lines
# pylint: disable=too-many-statements


def load_arguments(self, _): # pylint: disable=unused-argument
with self.argument_context('hdinsight-on-aks cluster trino-hive-catalog create') as c:
c.argument('catalog_name',
help='Name of trino catalog which should use specified hive metastore.')
c.argument('metastore_db_connection_url', options_list=['--metastore-db-connection-url', '--url'],
help='Connection string for hive metastore database.', required=True)
c.argument('metastore_db_connection_user_name', options_list=['--metastore-db-connection-user-name', '--user'],
help='User name for hive metastore database.', required=True)
c.argument('metastore_db_connection_password_secret',
options_list=['--metastore-db-connection-password-secret', '--secret'],
help='Password secret for hive metastore database.', required=True)
c.argument('metastore_warehouse_dir', options_list=['--metastore-warehouse-dir', '--warehouse-dir'],
help='Warehouse directory for hive metastore database.')

with self.argument_context('hdinsight-on-aks cluster node-profile create') as c:
c.argument('count',
help='The number of virtual machines.', required=True)
c.argument('node_type',
help='The node type.', required=True)
c.argument('vm_size',
help='The virtual machine SKU.', required=True)

with self.argument_context('hdinsight-on-aks cluster secret create') as c:
c.argument('secret_name',
help='The secret name in the key vault.', required=True)
c.argument('reference_name',
help='The reference name of the secret to be used in service configs.', required=True)
c.argument('version',
help='The version of the secret in key vault.')
6 changes: 6 additions & 0 deletions src/hdinsightonaks/azext_hdinsightonaks/aaz/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#
# Code generated by aaz-dev-tools
# --------------------------------------------------------------------------------------------
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#
# Code generated by aaz-dev-tools
# --------------------------------------------------------------------------------------------
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#
# Code generated by aaz-dev-tools
# --------------------------------------------------------------------------------------------

# pylint: skip-file
# flake8: noqa

from azure.cli.core.aaz import *


@register_command_group(
"hdinsight-on-aks",
is_preview=True,
)
class __CMDGroup(AAZCommandGroup):
"""HDInsight on Aks CLI.
"""
pass


__all__ = ["__CMDGroup"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#
# Code generated by aaz-dev-tools
# --------------------------------------------------------------------------------------------

# pylint: skip-file
# flake8: noqa

from .__cmd_group import *
from ._check_name_availability import *
from ._list_available_cluster_pool_version import *
from ._list_available_cluster_version import *
Loading

0 comments on commit 4e30684

Please sign in to comment.