Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Support bundle remove otel, exclude cert-manager from orc #320

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion azext_edge/edge/providers/support/orc.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
logger = get_logger(__name__)


ORC_APP_LABEL = "app in (aio-orc-api, cert-manager, cainjector, webhook)"
ORC_APP_LABEL = "app in (aio-orc-api)"
ORC_CONTROLLER_LABEL = "control-plane in (aio-plat-controller-manager)"
ORC_DIRECTORY_PATH = ORC_API_V1.moniker

Expand Down
56 changes: 0 additions & 56 deletions azext_edge/edge/providers/support/otel.py

This file was deleted.

5 changes: 0 additions & 5 deletions azext_edge/edge/providers/support_bundle.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ def build_bundle(
from .support.deviceregistry import prepare_bundle as prepare_deviceregistry_bundle
from .support.shared import prepare_bundle as prepare_shared_bundle
from .support.akri import prepare_bundle as prepare_akri_bundle
from .support.otel import prepare_bundle as prepare_otel_bundle
from .support.arcagents import prepare_bundle as prepare_arcagents_bundle
from .support.meta import prepare_bundle as prepare_meta_bundle

Expand Down Expand Up @@ -107,10 +106,6 @@ def build_bundle(

pending_work[service_moniker].update(bundle)

if ops_service == OpsServiceType.auto.value:
# Only attempt to collect otel resources if any AIO service is deployed AND auto is used.
pending_work["otel"] = prepare_otel_bundle()

# arc agent resources
pending_work["arcagents"] = prepare_arcagents_bundle(log_age_seconds)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,9 @@
from azext_edge.edge.providers.support.arcagents import ARC_AGENTS
from .helpers import (
assert_file_names,
check_workload_resource_files,
get_file_map,
process_top_levels,
run_bundle_command,
BASE_ZIP_PATH
BASE_ZIP_PATH,
)
from ....helpers import find_extra_or_missing_names

Expand Down Expand Up @@ -46,8 +44,7 @@ def test_create_bundle(init_setup, bundle_dir, mq_traces, ops_service, tracked_f
# generate second bundle as close as possible
if ops_service != OpsServiceType.auto.value:
auto_walk_result, _ = run_bundle_command(
command=command.format(OpsServiceType.auto.value),
tracked_files=tracked_files
command=command.format(OpsServiceType.auto.value), tracked_files=tracked_files
)

# Level 0 - top
Expand Down Expand Up @@ -82,7 +79,7 @@ def test_create_bundle(init_setup, bundle_dir, mq_traces, ops_service, tracked_f
if ops_service != OpsServiceType.auto.value:
expected_folders = [[]]
if mq_traces and ops_service == OpsServiceType.mq.value:
expected_folders.append(['traces'])
expected_folders.append(["traces"])
for directory in walk_result:
assert auto_walk_result[directory]["folders"] in expected_folders
# make things easier if there is a different file
Expand All @@ -93,42 +90,25 @@ def test_create_bundle(init_setup, bundle_dir, mq_traces, ops_service, tracked_f
result_names=auto_files,
expected_names=ser_files,
ignore_extras=True,
ignore_missing=True
ignore_missing=True,
)


def test_create_bundle_otel(init_setup, tracked_files):
"""Test for ensuring file names and content. ONLY CHECKS otel."""
# dir for unpacked files
ops_service = OpsServiceType.auto.value
command = f"az iot ops support create-bundle --ops-service {ops_service}"
walk_result, bundle_path = run_bundle_command(command=command, tracked_files=tracked_files)
file_map = get_file_map(walk_result, "otel")["aio"]

expected_workload_types = ["deployment", "pod", "replicaset", "service"]
assert set(file_map.keys()).issubset(set(expected_workload_types))
check_workload_resource_files(
file_objs=file_map,
expected_workload_types=expected_workload_types,
prefixes="aio-otel",
bundle_path=bundle_path
)


def _get_expected_services(
walk_result: Dict[str, Dict[str, List[str]]], ops_service: str , namespace: str
walk_result: Dict[str, Dict[str, List[str]]], ops_service: str, namespace: str
) -> List[str]:
expected_services = [ops_service]
if ops_service == OpsServiceType.auto.value:
# these should always be generated
expected_services = OpsServiceType.list()
expected_services.remove(OpsServiceType.auto.value)
expected_services.append("otel")
expected_services.sort()

# device registry folder will not be created if there are no device registry resources
if not walk_result.get(path.join(BASE_ZIP_PATH, namespace, OpsServiceType.deviceregistry.value))\
and OpsServiceType.deviceregistry.value in expected_services:
if (
not walk_result.get(path.join(BASE_ZIP_PATH, namespace, OpsServiceType.deviceregistry.value))
and OpsServiceType.deviceregistry.value in expected_services
):
expected_services.remove(OpsServiceType.deviceregistry.value)
expected_services.append("meta")
return expected_services
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ def test_create_bundle_orc(init_setup, tracked_files):
check_workload_resource_files(
file_objs=file_map,
expected_workload_types=expected_workload_types,
prefixes=["aio-cert", "aio-orc"],
prefixes=["aio-orc"],
bundle_path=bundle_path
)
22 changes: 0 additions & 22 deletions azext_edge/tests/edge/support/test_support_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
ORC_APP_LABEL,
ORC_CONTROLLER_LABEL,
)
from azext_edge.edge.providers.support.otel import OTEL_API, OTEL_NAME_LABEL
from azext_edge.edge.providers.support.common import (
COMPONENT_LABEL_FORMAT,
NAME_LABEL_FORMAT,
Expand Down Expand Up @@ -489,9 +488,6 @@ def test_create_bundle(
since_seconds=since_seconds,
)

if expected_resources:
assert_otel_kpis(mocked_client, mocked_zipfile, mocked_list_pods)

# assert shared KPIs regardless of service
assert_shared_kpis(mocked_client, mocked_zipfile)
# assert meta KPIs
Expand Down Expand Up @@ -830,24 +826,6 @@ def assert_meta_kpis(mocked_client, mocked_zipfile, mocked_list_pods):
assert_func(**kwargs)


def assert_otel_kpis(
mocked_client,
mocked_zipfile,
mocked_list_pods,
):
for assert_func in [assert_list_pods, assert_list_deployments, assert_list_services, assert_list_replica_sets]:
kwargs = {
"mocked_client": mocked_client,
"mocked_zipfile": mocked_zipfile,
"label_selector": OTEL_NAME_LABEL,
"directory_path": OTEL_API.moniker,
}
if assert_func == assert_list_pods:
kwargs["mocked_list_pods"] = mocked_list_pods

assert_func(**kwargs)


def assert_shared_kpis(mocked_client, mocked_zipfile):
mocked_client.CoreV1Api().list_node.assert_called_once()
assert_zipfile_write(mocked_zipfile, zinfo="nodes.yaml", data="items:\n- metadata:\n name: mock_node\n")
Expand Down