Skip to content

Commit

Permalink
feat: MQ v1beta1 support, renaming of Ops MQ (#62)
Browse files Browse the repository at this point in the history
* Update active MQ API version to v1b1

* Property renames and v1b1 adjustments

* Fixed broker test properties

* MQ improvements

* Use MQ_ACTIVE_API moniker for support bundle

* Remove private preview MQ API-versions

---------

Co-authored-by: Ryan Kelly <rykelly@microsoft.com>
  • Loading branch information
c-ryan-k and c-ryan-k authored Nov 1, 2023
1 parent 900987b commit 8a32567
Show file tree
Hide file tree
Showing 29 changed files with 369 additions and 374 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/post_create_commands.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ echo "This should automatically occur the next time you connect to the codespace
#
# az connectedk8s connect -n $CODESPACE_NAME -g $RESOURCE_GROUP
# az connectedk8s enable-features -n $CODESPACE_NAME -g $RESOURCE_GROUP --features cluster-connect custom-locations
# az edge init --cluster $CODESPACE_NAME -g $RESOURCE_GROUP [--create-sync-rules]
# az iot ops init --cluster $CODESPACE_NAME -g $RESOURCE_GROUP [--create-sync-rules]
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
# Some Windows-specific files should always be CRLF
*.bat eol=crlf

**/tests/edge/e4k/raw_stats.txt text eol=lf
**/tests/edge/mq/raw_stats.txt text eol=lf
10 changes: 5 additions & 5 deletions azext_edge/edge/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
"""

from knack.help_files import helps
from .providers.edge_api import E4K_ACTIVE_API
from .providers.edge_api import MQ_ACTIVE_API
from .providers.support_bundle import (
COMPAT_DATA_PROCESSOR_APIS,
COMPAT_E4K_APIS,
COMPAT_MQ_APIS,
COMPAT_LNM_APIS,
COMPAT_OPCUA_APIS,
COMPAT_SYMPHONY_APIS,
Expand Down Expand Up @@ -46,7 +46,7 @@ def load_iotedge_help():
short-summary: Creates a standard support bundle zip archive for use in troubleshooting and diagnostics.
long-summary: |
[Supported edge service APIs]
{COMPAT_E4K_APIS.as_str()}
{COMPAT_MQ_APIS.as_str()}
{COMPAT_OPCUA_APIS.as_str()}
{COMPAT_DATA_PROCESSOR_APIS.as_str()}
{COMPAT_SYMPHONY_APIS.as_str()}
Expand All @@ -61,7 +61,7 @@ def load_iotedge_help():
short-summary: Evaluate AIO edge service deployments for health, configuration and usability.
long-summary: |
[Supported edge service APIs]
{E4K_ACTIVE_API.as_str()}
{MQ_ACTIVE_API.as_str()}
"""

helps[
Expand All @@ -78,7 +78,7 @@ def load_iotedge_help():
short-summary: Show dmqtt running statistics.
long-summary: |
[Supported edge service APIs]
{E4K_ACTIVE_API.as_str()}
{MQ_ACTIVE_API.as_str()}
"""

helps[
Expand Down
4 changes: 2 additions & 2 deletions azext_edge/edge/command_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"""
from azure.cli.core.commands import CliCommandType

e4k_resource_ops = CliCommandType(operations_tmpl="azext_edge.edge.commands_e4k#{}")
mq_resource_ops = CliCommandType(operations_tmpl="azext_edge.edge.commands_mq#{}")
edge_resource_ops = CliCommandType(operations_tmpl="azext_edge.edge.commands_edge#{}")
asset_resource_ops = CliCommandType(operations_tmpl="azext_edge.edge.commands_assets#{}")

Expand All @@ -34,7 +34,7 @@ def load_iotedge_commands(self, _):

with self.command_group(
"iot ops mq",
command_type=e4k_resource_ops,
command_type=mq_resource_ops,
) as cmd_group:
cmd_group.command("stats", "stats")
cmd_group.command("get-password-hash", "get_password_hash")
Expand Down
2 changes: 1 addition & 1 deletion azext_edge/edge/commands_edge.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def check(
post_deployment_checks: Optional[bool] = None,
as_object=None,
context_name=None,
edge_service: str = "e4k",
edge_service: str = "mq",
resource_kinds: List[str] = None,
) -> Union[Dict[str, Any], None]:
load_config_context(context_name=context_name)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

from knack.log import get_logger
from .providers.base import load_config_context
from .common import AZEDGE_DIAGNOSTICS_SERVICE, METRICS_SERVICE_API_PORT, PROTOBUF_SERVICE_API_PORT
from .common import AIO_MQ_DIAGNOSTICS_SERVICE, METRICS_SERVICE_API_PORT, PROTOBUF_SERVICE_API_PORT

logger = get_logger(__name__)

Expand All @@ -17,7 +17,7 @@ def stats(
cmd,
namespace: Optional[str] = None,
context_name: Optional[str] = None,
diag_service_pod_prefix: str = AZEDGE_DIAGNOSTICS_SERVICE,
diag_service_pod_prefix: str = AIO_MQ_DIAGNOSTICS_SERVICE,
pod_metrics_port: int = METRICS_SERVICE_API_PORT,
pod_protobuf_port: int = PROTOBUF_SERVICE_API_PORT,
raw_response_print: Optional[bool] = None,
Expand All @@ -27,10 +27,10 @@ def stats(
trace_dir: Optional[str] = None,
):
load_config_context(context_name=context_name)
from .providers.edge_api import E4K_ACTIVE_API
from .providers.edge_api import MQ_ACTIVE_API
from .providers.stats import get_stats, get_traces

E4K_ACTIVE_API.is_deployed(raise_on_404=True)
MQ_ACTIVE_API.is_deployed(raise_on_404=True)
if trace_ids or trace_dir:
return get_traces(
namespace=namespace,
Expand Down
19 changes: 6 additions & 13 deletions azext_edge/edge/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ class ProvisioningState(Enum):
accepted = "Accepted"


class E4kDiagnosticPropertyIndex(Enum):
class MqDiagnosticPropertyIndex(Enum):
"""
E4K Diagnostic Property Index Strings
MQ Diagnostic Property Index Strings
"""

publishes_received_per_second = "e4k_publishes_received_per_second"
Expand All @@ -89,22 +89,14 @@ class SupportForEdgeServiceType(ListableEnum):
"""

auto = "auto"
e4k = "e4k"
mq = "mq"
lnm = "lnm"
opcua = "opcua"
dataprocessor = "dataprocessor"
symphony = "symphony"
deviceregistry = "deviceregistry"


class DeployablePasVersions(ListableEnum):
"""
Deployable PAS versions.
"""

v012 = "0.1.2"


class ResourceTypeMapping(Enum):
"""
Resource type mappings for graph queries.
Expand All @@ -125,8 +117,9 @@ class K8sSecretType(Enum):
tls = "kubernetes.io/tls"


# E4K runtime attributes
# MQ runtime attributes

AZEDGE_DIAGNOSTICS_SERVICE = "azedge-diagnostics-service"
AIO_MQ_DIAGNOSTICS_SERVICE = "aio-mq-diagnostics-service"
AIO_MQ_OPERATOR = "aio-mq-operator"
METRICS_SERVICE_API_PORT = 9600
PROTOBUF_SERVICE_API_PORT = 9800
16 changes: 8 additions & 8 deletions azext_edge/edge/params.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from azure.cli.core.commands.parameters import get_three_state_flag, get_enum_type, tags_type

from .common import SupportForEdgeServiceType
from .providers.edge_api import E4kResourceKinds
from .providers.edge_api import MqResourceKinds
from .providers.check.common import ResourceOutputDetailLevel
from .providers.edge_api.dataprocessor import DataProcessorResourceKinds
from .providers.orchestration.common import MqMemoryProfile, MqMode, MqServiceType
Expand Down Expand Up @@ -87,7 +87,7 @@ def load_iotedge_arguments(self, _):
context.argument(
"edge_service",
options_list=["--edge-service", "-e"],
choices=CaseInsensitiveList(["e4k"]),
choices=CaseInsensitiveList(["mq"]),
help="The edge service deployment that will be evaluated.",
)
context.argument(
Expand All @@ -96,12 +96,12 @@ def load_iotedge_arguments(self, _):
options_list=["--resources"],
choices=CaseInsensitiveList(
[
E4kResourceKinds.BROKER.value,
E4kResourceKinds.BROKER_LISTENER.value,
E4kResourceKinds.DIAGNOSTIC_SERVICE.value,
E4kResourceKinds.MQTT_BRIDGE_CONNECTOR.value,
E4kResourceKinds.DATALAKE_CONNECTOR.value,
E4kResourceKinds.KAFKA_CONNECTOR.value,
MqResourceKinds.BROKER.value,
MqResourceKinds.BROKER_LISTENER.value,
MqResourceKinds.DIAGNOSTIC_SERVICE.value,
MqResourceKinds.MQTT_BRIDGE_CONNECTOR.value,
MqResourceKinds.DATALAKE_CONNECTOR.value,
MqResourceKinds.KAFKA_CONNECTOR.value,
DataProcessorResourceKinds.DATASET.value,
DataProcessorResourceKinds.PIPELINE.value,
DataProcessorResourceKinds.INSTANCE.value,
Expand Down
6 changes: 3 additions & 3 deletions azext_edge/edge/providers/check/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,10 +372,10 @@ class CheckManager:
"""
{
"name":"evaluateBrokerListeners",
"description": "Evaluate E4K broker listeners",
"description": "Evaluate MQ broker listeners",
"status": "warning",
"targets": {
"az-edge.com/v1alpha4": {
"mq.iotoperations.azure.com/v1beta1": {
"_all_": {
"conditions": null,
"evaluations": [
Expand All @@ -386,7 +386,7 @@ class CheckManager:
],
}
},
"brokerlisteners.az-edge.com": {
"brokerlisteners.mq.iotoperations.azure.com": {
"default": {
"displays": [],
"conditions": [
Expand Down
16 changes: 8 additions & 8 deletions azext_edge/edge/providers/check/cloud_connectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@

from .common import ResourceOutputDetailLevel

from ...providers.edge_api import E4K_ACTIVE_API, E4kResourceKinds
from ..support.e4k import E4K_LABEL
from ...providers.edge_api import MQ_ACTIVE_API, MqResourceKinds
from ..support.mq import MQ_LABEL


def process_cloud_connector(
connector_target: str,
topic_map_target: str,
connector_display_name: str,
topic_map_reference_key: str,
connector_resource_kind: E4kResourceKinds,
topic_map_resource_kind: E4kResourceKinds,
connector_resource_kind: MqResourceKinds,
topic_map_resource_kind: MqResourceKinds,
connector_display_func: Callable[
[CheckManager, str, str, Dict[str, str], str, Tuple[int, int, int, int]], None
],
Expand All @@ -49,10 +49,10 @@ def process_cloud_connector(
connector_padding = (0, 0, 0, 8)
topic_map_padding = (0, 0, 0, 12)

all_connectors = E4K_ACTIVE_API.get_resources(kind=connector_resource_kind).get(
all_connectors = MQ_ACTIVE_API.get_resources(kind=connector_resource_kind).get(
"items", []
)
all_topic_maps = E4K_ACTIVE_API.get_resources(kind=topic_map_resource_kind).get(
all_topic_maps = MQ_ACTIVE_API.get_resources(kind=topic_map_resource_kind).get(
"items", []
)

Expand Down Expand Up @@ -190,7 +190,7 @@ def _display_connector_runtime_health(
namespace: str,
target: str,
connectors: Optional[List[Dict[str, Any]]] = None,
prefix: str = "azedge-",
prefix: str = "aio-mq-",
padding: int = 8,
):
if connectors:
Expand All @@ -213,7 +213,7 @@ def _display_connector_runtime_health(
namespace=namespace,
pod=pod,
display_padding=padding,
service_label=E4K_LABEL,
service_label=MQ_LABEL,
)


Expand Down
18 changes: 9 additions & 9 deletions azext_edge/edge/providers/check/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,16 +116,16 @@ class BluefinDestinationStageType(ListableEnum):
ALL_NAMESPACES_TARGET = '_all_'


class E4kCheckType(Enum):
class MqCheckType(Enum):
"""
E4K environment check type.
MQ environment check type.
"""

pre = "pre"
post = "post"


# E4k connector enums
# MQ connector enums
class KafkaTopicMapRouteType(Enum):
"""
Kafka Connector Topic Map Route type:
Expand All @@ -143,13 +143,13 @@ class KafkaTopicMapRouteType(Enum):
BLUEFIN_NATS_PREFIX = "bluefin-nats"
BLUEFIN_OPERATOR_CONTROLLER_MANAGER = "bluefin-operator-controller-manager"

# E4k runtime attributes
# MQ runtime attributes

AZEDGE_DIAGNOSTICS_PROBE_PREFIX = "azedge-diagnostics-probe"
AZEDGE_FRONTEND_PREFIX = "azedge-dmqtt-frontend"
AZEDGE_BACKEND_PREFIX = "azedge-dmqtt-backend"
AZEDGE_AUTH_PREFIX = "azedge-dmqtt-authentication"
AZEDGE_KAFKA_CONFIG_PREFIX = "azedge-kafka-config"
AIO_MQ_DIAGNOSTICS_PROBE_PREFIX = "aio-mq-diagnostics-probe"
AIO_MQ_FRONTEND_PREFIX = "aio-mq-dmqtt-frontend"
AIO_MQ_BACKEND_PREFIX = "aio-mq-dmqtt-backend"
AIO_MQ_AUTH_PREFIX = "aio-mq-dmqtt-authentication"
AIO_MQ_KAFKA_CONFIG_PREFIX = "aio-mq-kafka-config"

# Pre-deployment KPIs

Expand Down
Loading

0 comments on commit 8a32567

Please sign in to comment.