#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (C) 2019 tribe29 GmbH - License: GNU General Public License v2
# This file is part of Checkmk (https://checkmk.com). It is subject to the terms and
# conditions defined in the file COPYING, which is part of this source code package.

from cmk.base.check_legacy_includes.k8s import *  # pylint: disable=wildcard-import,unused-wildcard-import


def inv_k8s_assigned_pods(info, _inventory_tree, status_data_tree):
    parsed = parse_k8s(info)
    path = "software.applications.kubernetes.assigned_pods:"
    status_node = status_data_tree.get_list(path)

    for pod_name in sorted(parsed['names']):
        status_node.append({
            'name': pod_name,
        })


inv_info['k8s_assigned_pods'] = {
    'inv_function': inv_k8s_assigned_pods,
}
