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

Added FollowLogs class #214

Closed
wants to merge 1 commit into from
Closed

Added FollowLogs class #214

wants to merge 1 commit into from

Conversation

borremosch
Copy link

Because I was unable to follow the logs of a specific pod as described in #110, I created this helper class based on a combination of readNamespacedPodLog in api.ts and the Watch class in watch.ts.

@k8s-ci-robot
Copy link
Contributor

Thanks for your pull request. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please follow instructions at https://git.k8s.io/community/CLA.md#the-contributor-license-agreement to sign the CLA.

It may take a couple minutes for the CLA signature to be fully registered; after that, please reply here with a new comment and we'll verify. Thanks.


Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. label Feb 18, 2019
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: borremosch
To fully approve this pull request, please assign additional approvers.
We suggest the following additional approver: brendandburns

If they are not already assigned, you can assign the PR to them by writing /assign @brendandburns in a comment when ready.

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Feb 18, 2019
@borremosch
Copy link
Author

I have signed the CLA

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Feb 18, 2019
@@ -0,0 +1,116 @@
import { LineStream } from 'byline';
import request = require('request');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use newer import syntax everywhere.

const stream = new LineStream();
stream.on('data', (data) => {
callback(data.toString());
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably should have stream.on('error', ...)

@brendandburns
Copy link
Contributor

Thanks, this generally looks good, a few small comments.

* @param {FollowLogsOptions} options
*/
public followPodLog(
name: string,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we please make this consistent with the other api methods? namespace, podName, containerName

See
https://github.com/kubernetes-client/javascript/blob/master/src/exec.ts#L34
https://github.com/kubernetes-client/javascript/blob/master/src/attach.ts#L20
This only makes use of pod
https://github.com/kubernetes-client/javascript/blob/master/src/portforward.ts#L25

@brendandburns I would actually be in favour of requiring container name since logs operator on container similar to exec we can always default it to the cluster/config default if undefined.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's fine with me too. consistent api makes sense. thanks for higlighting that.

@brendandburns
Copy link
Contributor

@borremosch I'm going to merge #83 instead of this PR, since it was earlier (and subsumes this functionality) please have a look at that and see if it addresses your needs.

Thanks! (and apologies)

@drubin
Copy link
Contributor

drubin commented Jun 1, 2019

/close

Closing this in favor of #83 which was merged and lack of response.

@k8s-ci-robot
Copy link
Contributor

@drubin: Closed this PR.

In response to this:

/close

Closing this in favor of #83 which was merged and lack of response.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants