Skip to content

Commit

Permalink
chore: merge dev with feature/0.8.0 (#435)
Browse files Browse the repository at this point in the history
  • Loading branch information
digimaun authored Oct 31, 2024
2 parents dc4c422 + ffd48f5 commit 7f700a7
Show file tree
Hide file tree
Showing 65 changed files with 5,881 additions and 1,490 deletions.
20 changes: 16 additions & 4 deletions .github/workflows/int_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ on:
type: string
required: false
default: '51dfe1e8-70c6-4de5-a08e-e18aff23d815'
init-continue-on-error:
description: Continue on error for init integration tests
type: boolean
required: false
default: true
use-container:
description: Build container image for tests
type: boolean
Expand Down Expand Up @@ -228,8 +233,12 @@ jobs:
- name: "Containerized tests"
if: ${{ matrix.feature == 'default' && inputs.use-container }}
env:
azext_edge_rg: ${{ steps.env_out.outputs.CLUSTER_NAME }}
azext_edge_cluster: ${{ steps.env_out.outputs.RESOURCE_GROUP }}
azext_edge_skip_init: true # skip init tests in container
azext_edge_init_redeployment: false # ensure no redeployment in container
AIO_CLI_INIT_PREFLIGHT_DISABLED: ${{ steps.init.outputs.NO_PREFLIGHT }}
azext_edge_rg: ${{ steps.env_out.outputs.RESOURCE_GROUP }}
azext_edge_cluster: ${{ steps.env_out.outputs.CLUSTER_NAME }}
azext_edge_instance: ${{ steps.env_out.outputs.INSTANCE_NAME }}
run: |
# volume mounts
azure_dir=$(realpath ~/.azure)
Expand All @@ -239,9 +248,12 @@ jobs:
# env vars
envVars=()
envVars+=("-e" "azext_edge_cluster=$azext_edge_rg")
envVars+=("-e" "azext_edge_rg=$azext_edge_cluster")
envVars+=("-e" "azext_edge_skip_init=$azext_edge_skip_init")
envVars+=("-e" "azext_edge_init_redeployment=$azext_edge_init_redeployment")
envVars+=("-e" "AIO_CLI_INIT_PREFLIGHT_DISABLED=$AIO_CLI_INIT_PREFLIGHT_DISABLED")
envVars+=("-e" "azext_edge_rg=$azext_edge_rg")
envVars+=("-e" "azext_edge_cluster=$azext_edge_cluster")
envVars+=("-e" "azext_edge_instance=$azext_edge_instance")
envVars+=("-e" "KUBECONFIG=$kubeconfig_mount")
# Run tests
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/publish_test_container_image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ on:
type: boolean
required: true
default: false
continue-on-error:
description: Continue on error for init integration tests
type: boolean
required: false
default: true
name: Publish Integration Test Container Image
run-name: Publish Test Container${{ inputs.promote && ' [stable]' || '' }}
permissions:
Expand All @@ -18,6 +23,7 @@ jobs:
with:
resource-group: ops-cli-int-test-rg
use-container: true
init-continue-on-error: ${{ inputs.continue-on-error }}
secrets:
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
Expand Down
2 changes: 1 addition & 1 deletion azext_edge/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import os

VERSION = "0.7.0b2"
VERSION = "0.8.0b1"
EXTENSION_NAME = "azure-iot-ops"
EXTENSION_ROOT = os.path.dirname(os.path.abspath(__file__))
USER_AGENT = "IotOperationsCliExtension/{}".format(VERSION)
352 changes: 334 additions & 18 deletions azext_edge/edge/_help.py

Large diffs are not rendered by default.

41 changes: 40 additions & 1 deletion azext_edge/edge/command_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
secretsync_resource_ops = CliCommandType(operations_tmpl="azext_edge.edge.commands_secretsync#{}")
asset_resource_ops = CliCommandType(operations_tmpl="azext_edge.edge.commands_assets#{}")
aep_resource_ops = CliCommandType(operations_tmpl="azext_edge.edge.commands_asset_endpoint_profiles#{}")
connector_resource_ops = CliCommandType(operations_tmpl="azext_edge.edge.commands_connector#{}")


def load_iotops_commands(self, _):
Expand All @@ -29,6 +30,7 @@ def load_iotops_commands(self, _):
) as cmd_group:
cmd_group.command("check", "check")
cmd_group.command("init", "init")
cmd_group.command("upgrade", "upgrade")
cmd_group.command("create", "create_instance")
cmd_group.command("update", "update_instance")
cmd_group.show_command("show", "show_instance")
Expand All @@ -50,7 +52,7 @@ def load_iotops_commands(self, _):
) as cmd_group:
cmd_group.command("enable", "secretsync_enable")
cmd_group.command("disable", "secretsync_disable")
cmd_group.show_command("show", "secretsync_show")
cmd_group.show_command("list", "secretsync_list")

with self.command_group(
"iot ops support",
Expand Down Expand Up @@ -164,6 +166,16 @@ def load_iotops_commands(self, _):
) as cmd_group:
cmd_group.command("opcua", "create_opcua_asset_endpoint_profile")

with self.command_group(
"iot ops schema",
command_type=schema_resource_ops,
) as cmd_group:
cmd_group.command("create", "create_schema")
cmd_group.show_command("show", "show_schema")
cmd_group.command("list", "list_schemas")
cmd_group.command("show-dataflow-refs", "list_schema_versions_dataflow_format")
cmd_group.command("delete", "delete_schema")

with self.command_group(
"iot ops schema registry",
command_type=schema_resource_ops,
Expand All @@ -172,3 +184,30 @@ def load_iotops_commands(self, _):
cmd_group.show_command("show", "show_registry")
cmd_group.command("list", "list_registries")
cmd_group.command("delete", "delete_registry")

with self.command_group(
"iot ops connector opcua trust",
command_type=connector_resource_ops,
) as cmd_group:
cmd_group.command("add", "add_connector_opcua_trust")

with self.command_group(
"iot ops connector opcua issuer",
command_type=connector_resource_ops,
) as cmd_group:
cmd_group.command("add", "add_connector_opcua_issuer")

with self.command_group(
"iot ops connector opcua client",
command_type=connector_resource_ops,
) as cmd_group:
cmd_group.command("add", "add_connector_opcua_client")

with self.command_group(
"iot ops schema version",
command_type=schema_resource_ops,
) as cmd_group:
cmd_group.command("add", "add_version")
cmd_group.show_command("show", "show_version")
cmd_group.command("list", "list_versions")
cmd_group.command("remove", "remove_version")
61 changes: 61 additions & 0 deletions azext_edge/edge/commands_connector.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# coding=utf-8
# ----------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License file in the project root for license information.
# ----------------------------------------------------------------------------------------------

from typing import Optional
from .providers.orchestration.resources.connector.opcua.certs import OpcUACerts


def add_connector_opcua_trust(
cmd,
instance_name: str,
resource_group: str,
file: str,
secret_name: Optional[str] = None,
) -> dict:
return OpcUACerts(cmd).trust_add(
instance_name=instance_name,
resource_group=resource_group,
file=file,
secret_name=secret_name,
)


def add_connector_opcua_issuer(
cmd,
instance_name: str,
resource_group: str,
file: str,
secret_name: Optional[str] = None,
) -> dict:
return OpcUACerts(cmd).issuer_add(
instance_name=instance_name,
resource_group=resource_group,
file=file,
secret_name=secret_name,
)


def add_connector_opcua_client(
cmd,
instance_name: str,
resource_group: str,
public_key_file: str,
private_key_file: str,
subject_name: str,
application_uri: str,
public_key_secret_name: Optional[str] = None,
private_key_secret_name: Optional[str] = None,
) -> dict:
return OpcUACerts(cmd).client_add(
instance_name=instance_name,
resource_group=resource_group,
public_key_file=public_key_file,
private_key_file=private_key_file,
subject_name=subject_name,
application_uri=application_uri,
public_key_secret_name=public_key_secret_name,
private_key_secret_name=private_key_secret_name,
)
49 changes: 37 additions & 12 deletions azext_edge/edge/commands_edge.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,10 @@ def init(
cmd,
cluster_name: str,
resource_group_name: str,
schema_registry_resource_id: str,
container_runtime_socket: Optional[str] = None,
kubernetes_distro: str = KubernetesDistroType.k8s.value,
trust_settings: Optional[List[str]] = None,
enable_fault_tolerance: Optional[bool] = None,
ops_config: Optional[List[str]] = None,
ops_version: Optional[str] = None,
no_progress: Optional[bool] = None,
ensure_latest: Optional[bool] = None,
user_trust: Optional[bool] = None,
**kwargs,
) -> Union[Dict[str, Any], None]:
from .common import INIT_NO_PREFLIGHT_ENV_KEY
Expand All @@ -134,13 +129,29 @@ def init(
pre_flight=not no_pre_flight,
cluster_name=cluster_name,
resource_group_name=resource_group_name,
container_runtime_socket=container_runtime_socket,
kubernetes_distro=kubernetes_distro,
enable_fault_tolerance=enable_fault_tolerance,
ops_config=ops_config,
ops_version=ops_version,
trust_settings=trust_settings,
schema_registry_resource_id=schema_registry_resource_id,
user_trust=user_trust,
)


def upgrade(
cmd,
resource_group_name: str,
instance_name: str,
schema_registry_resource_id: Optional[str] = None,
no_progress: Optional[bool] = None,
confirm_yes: Optional[bool] = None,
**kwargs
):
from .providers.orchestration.upgrade import upgrade_ops_resources
return upgrade_ops_resources(
cmd=cmd,
resource_group_name=resource_group_name,
instance_name=instance_name,
sr_resource_id=schema_registry_resource_id,
no_progress=no_progress,
confirm_yes=confirm_yes,
**kwargs
)


Expand All @@ -149,12 +160,19 @@ def create_instance(
cluster_name: str,
resource_group_name: str,
instance_name: str,
schema_registry_resource_id: str,
cluster_namespace: str = DEFAULT_NAMESPACE,
location: Optional[str] = None,
custom_location_name: Optional[str] = None,
enable_rsync_rules: Optional[bool] = None,
instance_description: Optional[str] = None,
dataflow_profile_instances: int = 1,
trust_settings: Optional[List[str]] = None,
# Ops extension
container_runtime_socket: Optional[str] = None,
kubernetes_distro: str = KubernetesDistroType.k8s.value,
ops_config: Optional[List[str]] = None,
ops_version: Optional[str] = None,
# Broker
custom_broker_config_file: Optional[str] = None,
broker_memory_profile: str = MqMemoryProfile.medium.value,
Expand Down Expand Up @@ -196,13 +214,20 @@ def create_instance(
cluster_name=cluster_name,
resource_group_name=resource_group_name,
cluster_namespace=cluster_namespace,
schema_registry_resource_id=schema_registry_resource_id,
location=location,
custom_location_name=custom_location_name,
enable_rsync_rules=enable_rsync_rules,
instance_name=instance_name,
instance_description=instance_description,
add_insecure_listener=add_insecure_listener,
dataflow_profile_instances=dataflow_profile_instances,
trust_settings=trust_settings,
# Ops Extension
container_runtime_socket=container_runtime_socket,
kubernetes_distro=kubernetes_distro,
ops_config=ops_config,
ops_version=ops_version,
# Broker
custom_broker_config=custom_broker_config,
broker_memory_profile=broker_memory_profile,
Expand Down
Loading

0 comments on commit 7f700a7

Please sign in to comment.