-
Notifications
You must be signed in to change notification settings - Fork 39.7k
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
[WIP] Forking glog into third_party/ directory #69333
[WIP] Forking glog into third_party/ directory #69333
Conversation
bdf8d15
to
bcad164
Compare
/test pull-kubernetes-bazel-test |
bcad164
to
a3693a4
Compare
related to #61006 |
would be quite nice if this works! 👍 |
@neolit123 well, all the tests are running fine, couple of small things in verify that can be dealt with. For sure, i'd like someone like @obeattie, @alexellis or others who were actively advocating the fork in #61006 to pick up the torch from this experiment and run with it. |
@dims I'd like to be able to take advantage of the changes we make in non-k/k repos (in particular, to fix all the container images that require a shell just to redirect the logs). Will it be possible to vendor the fork from here, or should we consider putting it elsewhere (perhaps it's own repo?) |
@tallclair my thought was to iterate here in k/k first, then put the fork in its own repo and get the projects in our dependencies to switch over. for example, we need to take care of problems with say |
a3693a4
to
eae5faf
Compare
eae5faf
to
93b3a74
Compare
- fork code into third_party/forked/glog/ directory - patch up hack/godep-save.sh to make sure links are created - patch hack/verify-pkg-names.sho to skip the forked glog directory - link vendor/github.com/golang/glog/glog.go and glog_file.go from the forked directory Change-Id: Ife852c6e8f868ba157a4d6c3dc7c66c1bfac91e7
- Move all flag initialization to a single init() block - add a new option `log-file` - Avoid creating directories when `log-file` is specified Change-Id: I04ef706af9260902aacf43a38ed75ba06df1449d
Change-Id: Id5a97c61d5f611959a284e1fa0ca79091495dd02
Change-Id: I95f1bbdeaf9c993c704a7984a4ad4770436cc8fe
Change-Id: I010ebb01483bfb53b532646047d959ce6c7d0579
Change-Id: Iecf92407333123d6427476edcd093b9df99fc3e8
9b71ee1
to
502a9ca
Compare
/test pull-kubernetes-integration |
/test pull-kubernetes-e2e-kubeadm-gce |
502a9ca
to
98b08a7
Compare
else | ||
kube::log::status "creating symbolic link to forked $file" | ||
rm -f "vendor/github.com/golang/glog/$file" || true | ||
ln -s "../../../../third_party/forked/glog/$file" "vendor/github.com/golang/glog/$file" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why can't we just link the directory, like we do for staging stuff
@@ -81,6 +81,17 @@ for repo in $(ls staging/src/k8s.io); do | |||
fi | |||
done | |||
|
|||
for file in "README" "LICENSE" "glog.go" "glog_file.go" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs comments
@@ -26,7 +26,7 @@ source "${KUBE_ROOT}/hack/lib/init.sh" | |||
kube::golang::verify_go_version | |||
|
|||
cd "${KUBE_ROOT}" | |||
if git --no-pager grep -E $'^(import |\t)[a-z]+[A-Z_][a-zA-Z]* "[^"]+"$' -- '**/*.go' ':(exclude)vendor/*' ':(exclude)**.*.pb.go'; then | |||
if git --no-pager grep -E $'^(import |\t)[a-z]+[A-Z_][a-zA-Z]* "[^"]+"$' -- '**/*.go' ':(exclude)vendor/*' ':(exclude)**.*.pb.go' ':(exclude)third_party/forked/glog/*'; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
needs comments
limitations under the License. | ||
*/ | ||
|
||
package glog // import "k8s.io/third_party/forked/glog" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this really the canonical import path we want? I don't understand.
if *logDir != "" { | ||
logDirs = append(logDirs, *logDir) | ||
// if log-file is not specified, only then try to use logDir | ||
if logging.logFile == "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Writing this as a switch would maybe make it easier to read
logDirs = append(logDirs, *logDir) | ||
// if log-file is not specified, only then try to use logDir | ||
if logging.logFile == "" { | ||
// if log-dir is not specified, then use temp directory |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a pretty deep change - it changes "log to all dirs" into "log to one dir", if I read correctly. Why bother to keep logDirs as a plural at this point?
@@ -677,6 +677,42 @@ func (l *loggingT) printWithFileLine(s severity, file string, line int, alsoToSt | |||
l.output(s, buf, file, line, alsoToStderr) | |||
} | |||
|
|||
type redirectBuffer struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comments
pkg/kubectl/util/logs/logs.go
Outdated
@@ -27,19 +28,20 @@ import ( | |||
|
|||
var logFlushFreq = pflag.Duration("log-flush-frequency", 5*time.Second, "Maximum number of seconds between log flushes") | |||
|
|||
// GlogWriter serves as a bridge between the standard log package and the glog package. | |||
type GlogWriter struct{} | |||
// ErrorLogWriter serves as a bridge between the standard log package and the glog package. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be better or worse to set --log-file=/dev/stderr instead of this? It seems less invasive and maybe we could drop the SetOutput stuff ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In doing it this way, do you lose teh formatted prefix (timestamp, etc) on each line? Or if not, and you send to another logger, do you log two timestamps?
pkg/kubectl/util/logs/logs.go
Outdated
@@ -28,17 +30,18 @@ import ( | |||
|
|||
var logFlushFreq = pflag.Duration("log-flush-frequency", 5*time.Second, "Maximum number of seconds between log flushes") | |||
|
|||
// ErrorLogWriter serves as a bridge between the standard log package and the glog package. | |||
type ErrorLogWriter struct{} | |||
// SysLogWriter serves as a bridge between the standard log package and the glog package. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a change we want to keep or just a proof?
So, IIUC, the discussion comes down to which path to choose:
@DirectXMan12 @tallclair what else am I missing? |
I don't see how 3 depends on 2. The two steps seem like they can be in
either order, and the major difference is which order to run with.
…On Thu, Oct 25, 2018 at 10:34 AM Davanum Srinivas ***@***.***> wrote:
@thockin <https://github.com/thockin> i'd like to open the door for #3
<#3> for long term and #2
<#2> for the short-term.
We cannot do #3 <#3>
without doing #2 <#2>. We
can talk more on the call
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#69333 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AFVgVGzM5ZwyB_Lcsl4akNNNjIJA7fncks5uofY-gaJpZM4XEevI>
.
|
Change-Id: I80e40b20298c73f3eefe8b743ad46871af24a73b
98b08a7
to
a03f52f
Compare
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: dims If they are not already assigned, you can assign the PR to them by writing 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 |
@dims: The following test failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. 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. |
@dims: PR needs rebase. 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. |
we now have |
Change-Id: I9756b73c806f8e29edabae3999c06d4083a6527b
What this PR does / why we need it:
Forking glog is a first step to essentially get rid of it, please see discussion in #61006 and elsewhere on why glog id problematic
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes #
Special notes for your reviewer:
Release note: