Skip to content

pods-read-logs issue in watch with follow = true #153

@carminati-marco

Description

@carminati-marco

we don't have container_name here

container=data["container_name"],

it must be reverted, removing it and adding to

namespace=data["namespace"],

suggestion

            if data["container_name"]:
                w = watch.Watch()
                for line in w.stream(v1.read_namespaced_pod_log,
                                     namespace=data["namespace"],
                                     name=data["name"],
                                     tail_lines=os.environ.get('RD_CONFIG_NUMBER_OF_LINES'),
                                     follow=False):
                    print(line.encode('ascii', 'ignore'))
            else:
                w = watch.Watch()
                for line in w.stream(v1.read_namespaced_pod_log,
                                     container=data["container_name"],
                                     namespace=data["namespace"],
                                     name=data["name"],
                                     tail_lines=os.environ.get('RD_CONFIG_NUMBER_OF_LINES'),
                                     follow=False):
                    print(line.encode('ascii', 'ignore'))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions