Skip to content

Conversation

@xagent003
Copy link
Contributor

@xagent003 xagent003 commented Mar 29, 2022

Fix for #198

This solves many logging issues we've had with whereabouts and the ip-reconciler. We already have this working on our custom whereabouts fork we use in production (https://github.com/platform9/whereabouts), would like to get it merged upstream:

  1. ip-reconciler logs are lost once the Pod is terminated. This was made worse by changing the succesful job history to 0 since all the bugs we've seen were when the Job was Succesful. So, have it mount a volume on host and write to a proper log file. This way if container is cleaned up, the logs are still accessible.

  2. whereabouts is using a custom logging package which is a wrapper around Printf. Instead, use a common logger like Zap logger. Also, use lumberjack package for built in file rotation. This works for both whereabouts and new file based ip-reconciler logging in point 1 above, and the logs are rotated automatically.

Yes, the default logging level is debug. I think we need it until this matures as we see a lot of whereabouts and ip-reconciler issues that simply would not be debuggable otherwise.

@xagent003 xagent003 force-pushed the private/arjun/upstreamLoggingFix branch from 665119a to 3cb6f11 Compare March 29, 2022 23:44
@maiqueb
Copy link
Collaborator

maiqueb commented Mar 31, 2022

Fix for #198

This solves many logging issues we've had with whereabouts and the ip-reconciler. We already have this working on our custom whereabouts fork we use in production (https://github.com/platform9/whereabouts), would like to get it merged upstream:

  1. ip-reconciler logs are lost once the Pod is terminated. This was made worse by changing the succesful job history to 0 since all the bugs we've seen were when the Job was Succesful. So, have it mount a volume on host and write to a proper log file. This way if container is cleaned up, the logs are still accessible.

Makes sense to me.

  1. whereabouts is using a custom logging package which is a wrapper around Printf. Instead, use a common logger like Zap logger. Also, use lumberjack package for built in file rotation. This works for both whereabouts and new file based ip-reconciler logging in point 1 above, and the logs are rotated automatically.

Makes sense to me. Thanks for the effort in this one.

Yes, the default logging level is debug. I think we need it until this matures as we see a lot of whereabouts and ip-reconciler issues that simply would not be debuggable otherwise.

I don't understand why you are removing the log-level configuration parameter. It still makes sense to have it.

Copy link
Collaborator

@maiqueb maiqueb left a comment

Choose a reason for hiding this comment

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

Shouldn't the vendored files be added as well ? I think you haven't go mod vendor - but I might be wrong.

func main() {
kubeConfigFile := flag.String("kubeconfig", "", "the path to the Kubernetes configuration file")
logLevel := flag.String("log-level", "error", "the logging level for the `ip-reconciler` app. Valid values are: \"debug\", \"verbose\", \"error\", and \"panic\".")
logFile := flag.String("log-file", "/host/var/log/ip-reconciler.log", "File on host for ip-reconciler to log to")
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't understand why you are removing the log level parameter. It still makes sense.

Also, you cannot use this default - i.e. what if the cronjob spec does not feature the volume mount ? It will fail.

You should use a default on the container file system, but override that in the daemonset spec shipped in whereabouts.

spec:
concurrencyPolicy: Forbid
successfulJobsHistoryLimit: 0
successfulJobsHistoryLimit: 3
Copy link
Collaborator

Choose a reason for hiding this comment

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

If you're now logging to the host's file-system, why would we want to preserve these around ?

@xagent003
Copy link
Contributor Author

@maiqueb you're right, I think I can make the log-level configureable in zap/lumberjack... will try adding that.

@dougbtv
Copy link
Member

dougbtv commented Apr 1, 2022

Thanks for the review Miguel. I'm in favor of this PR, these changes make sense. +1 re: log-level configuration, good to go with that in place. Thanks

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

Successfully merging this pull request may close these issues.

3 participants