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

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

Open
carminati-marco opened this issue Mar 16, 2023 · 0 comments
Open

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

carminati-marco opened this issue Mar 16, 2023 · 0 comments

Comments

@carminati-marco
Copy link

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'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant