Skip to content

Commit 11daeac

Browse files
committed
reverting ClusterInfo to its original shape, removing kubeconfig field, providing more specific description for initiating scan on the kubernetes, removing cluster_config variable
Signed-off-by: Piotr <[email protected]>
1 parent 1d332ae commit 11daeac

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

Tests/kaas/k8s-version-policy/k8s_version_policy.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,6 @@ def __contains__(self, version: K8sVersion) -> bool:
281281
class ClusterInfo:
282282
version: K8sVersion
283283
name: str
284-
kubeconfig: str
285284

286285

287286
async def request_cve_data(session: aiohttp.ClientSession, cveid: str) -> dict:
@@ -426,7 +425,6 @@ async def run_trivy_scan(image: str) -> dict:
426425

427426
async def get_k8s_pod_images(kubeconfig, context=None) -> list[str]:
428427
"""Get the list of container images used by all the pods in the Kubernetes cluster."""
429-
cluster_config = await kubernetes_asyncio.config.load_kube_config(kubeconfig, context)
430428

431429
async with kubernetes_asyncio.client.ApiClient() as api:
432430
v1 = kubernetes_asyncio.client.CoreV1Api(api)
@@ -563,9 +561,12 @@ async def main(argv):
563561
releases_data = fetch_k8s_releases_data()
564562

565563
try:
566-
logger.info(f"Checking cluster specified by {kubeconfig_path}")
564+
logger.info(
565+
f"""Initiating scan on the Kubernetes cluster specified by kubeconfig at '{kubeconfig_path}'
566+
{' with context ' + config.context if config.context else ''}.
567+
Fetching cluster information and verifying access.""")
567568
cluster = await get_k8s_cluster_info(config.kubeconfig, config.context)
568-
await scan_k8s_images(cluster.kubeconfig)
569+
await scan_k8s_images(config.kubeconfig)
569570

570571
except CriticalException as e:
571572
logger.critical(e)

0 commit comments

Comments
 (0)