Beispiel #1
0
def dump_pod_tokens(name, namespace, read_token_from_container=False):
    pod_with_tokens = []
    containers = dump_containers_tokens_by_pod(name, namespace,
                                               read_token_from_container)
    pod_with_tokens.append(Pod(name, namespace, containers))

    return pod_with_tokens
Beispiel #2
0
def dump_all_pods_tokens_or_by_namespace(namespace=None):
    pods_with_tokens = []
    pods = list_pods_for_all_namespaces_or_one_namspace(namespace)
    for pod in pods.items:
        containers = dump_containers_tokens_by_pod(pod.metadata.name, pod.metadata.namespace)
        pods_with_tokens.append(Pod(pod.metadata.name, pod.metadata.namespace, containers))

    return pods_with_tokens
Beispiel #3
0
def get_risky_pods():
    risky_pods = []
    pods = api_client.CoreV1Api.list_pod_for_all_namespaces(watch=False)
    risky_users = get_all_risky_subjects()
    for pod in pods.items:
        risky_containers = get_risky_containers(pod, risky_users)
        if len(risky_containers) > 0:
            risky_pods.append(Pod(pod.metadata.name, pod.metadata.namespace, risky_containers))

    return risky_pods
Beispiel #4
0
def get_risky_pods(namespace=None, deep_analysis=False):
    risky_pods = []
    pods = list_pods_for_all_namespaces_or_one_namspace(namespace)
    risky_users = get_all_risky_subjects()
    for pod in pods.items:
        risky_containers = get_risky_containers(pod, risky_users, deep_analysis)
        if len(risky_containers) > 0:
            risky_pods.append(Pod(pod.metadata.name, pod.metadata.namespace, risky_containers))

    return risky_pods
Beispiel #5
0
def dump_pod_tokens(name, namespace):
    pod_with_tokens = []
    containers = dump_containers_tokens_by_pod(name, namespace)
    pod_with_tokens.append(Pod(name, namespace, containers))

    return pod_with_tokens