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

refactor: support bundle {process_resource} func parameter combine resource_api moniker and sub_group #214

Merged
merged 11 commits into from
Jun 4, 2024
21 changes: 11 additions & 10 deletions azext_edge/edge/providers/support/akri.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

AKRI_NAME_LABEL_V2 = NAME_LABEL_FORMAT.format(label=AKRI_API_V0.label)
AKRI_POD_NAME_LABEL = NAME_LABEL_FORMAT.format(label=f"{AKRI_AGENT_LABEL}, {AKRI_WEBHOOK_LABEL}")
AKRI_FILE_PATH = AKRI_API_V0.moniker


def fetch_pods(since_seconds: int = DAY_IN_SECONDS):
Expand All @@ -45,15 +46,15 @@ def fetch_pods(since_seconds: int = DAY_IN_SECONDS):
for pod_name_label in pod_name_labels:
processed.extend(
process_v1_pods(
resource_api=AKRI_API_V0,
file_path=AKRI_FILE_PATH,
label_selector=pod_name_label,
since_seconds=since_seconds,
)
)

processed.extend(
process_v1_pods(
resource_api=AKRI_API_V0,
file_path=AKRI_FILE_PATH,
label_selector=AKRI_NAME_LABEL_V2,
since_seconds=since_seconds,
)
Expand All @@ -71,14 +72,14 @@ def fetch_deployments():
for deployment_name_label in deployment_name_labels:
processed.extend(
process_deployments(
resource_api=AKRI_API_V0,
file_path=AKRI_FILE_PATH,
label_selector=deployment_name_label,
)
)

processed.extend(
process_deployments(
resource_api=AKRI_API_V0,
file_path=AKRI_FILE_PATH,
label_selector=AKRI_NAME_LABEL_V2,
)
)
Expand All @@ -94,13 +95,13 @@ def fetch_daemonsets():
for daemonset_name_label in daemonset_name_labels:
processed.extend(
process_daemonsets(
resource_api=AKRI_API_V0,
file_path=AKRI_FILE_PATH,
label_selector=daemonset_name_label,
)
)

processed.extend(
process_daemonsets(resource_api=AKRI_API_V0, label_selector=AKRI_NAME_LABEL_V2)
process_daemonsets(file_path=AKRI_FILE_PATH, label_selector=AKRI_NAME_LABEL_V2)
)
return processed

Expand All @@ -115,13 +116,13 @@ def fetch_services():
for service_name_label in service_name_labels:
processed.extend(
process_services(
resource_api=AKRI_API_V0,
file_path=AKRI_FILE_PATH,
label_selector=service_name_label,
)
)

processed.extend(
process_services(resource_api=AKRI_API_V0, label_selector=AKRI_NAME_LABEL_V2)
process_services(file_path=AKRI_FILE_PATH, label_selector=AKRI_NAME_LABEL_V2)
)
return processed

Expand All @@ -136,13 +137,13 @@ def fetch_replicasets():
for replicaset_name_label in replicaset_name_labels:
processed.extend(
process_replicasets(
resource_api=AKRI_API_V0,
file_path=AKRI_FILE_PATH,
label_selector=replicaset_name_label,
)
)

processed.extend(
process_replicasets(resource_api=AKRI_API_V0, label_selector=AKRI_NAME_LABEL_V2)
process_replicasets(file_path=AKRI_FILE_PATH, label_selector=AKRI_NAME_LABEL_V2)
)
return processed

Expand Down
Loading