Skip to content

Added FollowLogs class - #214

Closed
borremosch wants to merge 1 commit into
kubernetes-client:masterfrom
borremosch:add-follow-logs
Closed

borremosch wants to merge 1 commit into
kubernetes-client:masterfrom
borremosch:add-follow-logs

Conversation

@borremosch

Copy link
Copy Markdown

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
Copy Markdown
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.


Details

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
Copy Markdown
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

Details 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
Copy Markdown
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
Comment thread src/follow_logs.ts
@@ -0,0 +1,116 @@
import { LineStream } from 'byline';
import request = require('request');

Copy link
Copy Markdown
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.

Comment thread src/follow_logs.ts
const stream = new LineStream();
stream.on('data', (data) => {
callback(data.toString());
});

Copy link
Copy Markdown
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
Copy Markdown
Contributor

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

Comment thread src/follow_logs.ts
* @param {FollowLogsOptions} options
*/
public followPodLog(
name: string,

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

drubin commented Jun 1, 2019

Copy link
Copy Markdown
Contributor

/close

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

@k8s-ci-robot

Copy link
Copy Markdown
Contributor

@drubin: Closed this PR.

Details

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.

4 participants