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

Add support for getting logs from a Kubernetes Pod #53418

Open
wants to merge 6 commits into
base: devel
from

Conversation

Projects
None yet
5 participants
@fabianvf
Copy link
Contributor

fabianvf commented Mar 6, 2019

SUMMARY

Adds the k8s_log module, which allows you to pull logs from any resource that supports the /log endpoint (mostly just Pods I think).

ISSUE TYPE
  • New Module Pull Request
COMPONENT NAME

k8s
k8s_log

@ansibot

This comment has been minimized.

Copy link
Contributor

ansibot commented Mar 6, 2019

@erjohnso @flaper87 @kubevirt @supertom

As a maintainer of a module in the same namespace this new module has been submitted to, your vote counts for shipits. Please review this module and add shipit if you would like to see it merged.

click here for bot help

@ansibot

This comment has been minimized.

import copy


class KubernetesFactsModule(KubernetesAnsibleModule):

This comment has been minimized.

@djzager

djzager Mar 7, 2019

Contributor

This class name doesn't look write. Copypasta?

to identify a specfic object.
container:
description:
- Use to specify the container within a pod to grab the log from

This comment has been minimized.

@djzager

djzager Mar 7, 2019

Contributor

Does this not being required mean that you will grab the log from the first container? Maybe you could specify the behavior when it's not included.

@djzager

djzager approved these changes Mar 7, 2019

Copy link
Contributor

djzager left a comment

Not that my vote means much. But this LGTM.

@maxamillion

This comment has been minimized.

Copy link
Contributor

maxamillion commented Mar 7, 2019

I'm not entirely sure this adds any "value" over calling the REST API directly, which goes against documented Ansible development guidelines. https://docs.ansible.com/ansible/latest/dev_guide/developing_modules_best_practices.html

@ansibot ansibot removed the needs_triage label Mar 7, 2019

@fabianvf

This comment has been minimized.

Copy link
Contributor Author

fabianvf commented Mar 7, 2019

There's significant complexity to authenticating to the API, doing it generically in pure Ansible would be really dirty. this module uses the same authentication methods as the other k8s modules, which can load certs, incluster configuration, kubeconfigs (which can include executing binaries for aws/gke etc). I think removing this complexity constitutes value over calling the API directly.

@fabianvf fabianvf closed this Mar 7, 2019

@fabianvf fabianvf reopened this Mar 7, 2019

fabianvf added some commits Mar 13, 2019

@fabianvf

This comment has been minimized.

Copy link
Contributor Author

fabianvf commented Mar 20, 2019

ping @willthames I added the ability to use a label_selector, as well as grab label_selectors from the spec of an object that define selectors (like Deployments, StatefulSets etc).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.