-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
CMP write to container log #15921
Comments
This would also make development of sidecars easier and would support #15006 |
How about logging to stdout? Argo CD could pick that up and write it directly to the sidecar logs, regardless of whether the generate command succeeds. |
This would be the easiest solution, but currently CMP assumes that everything written to stdout is a kubernetes object, in either YAML or JSON, at least according to the documentation: https://argo-cd.readthedocs.io/en/stable/operator-manual/config-management-plugins/#write-the-plugin-configuration-file Maybe logging to stderr and forwarding that to the sidecar logs, regardless of the command exit code, would be an alternative. |
Ah, yep, I meant stderr. Yay Friday brain. I think that would be a fine solution! |
That would also be quite easy to implement I think. Looking at the code in the cmpserver/plugin I think it just needs an additional log statement for the success cases around here: https://github.com/argoproj/argo-cd/blob/master/cmpserver/plugin/plugin.go#L123 If you're open to this change, I would create a pull request for it. |
Yep, please open a PR! For just some logging, I think we're okay without a test |
I've opened the pull request |
…15973) * feat(cmp): Print stderr output from command even on success Signed-off-by: Mathias Petermann <[email protected]> * docs(cmp): Document logging from cmp sidecard for development purposes Signed-off-by: Mathias Petermann <[email protected]> --------- Signed-off-by: Mathias Petermann <[email protected]>
…15973) * feat(cmp): Print stderr output from command even on success Signed-off-by: Mathias Petermann <[email protected]> * docs(cmp): Document logging from cmp sidecard for development purposes Signed-off-by: Mathias Petermann <[email protected]> --------- Signed-off-by: Mathias Petermann <[email protected]>
…15973) (#16075) * feat(cmp): Print stderr output from command even on success * docs(cmp): Document logging from cmp sidecard for development purposes --------- Signed-off-by: Mathias Petermann <[email protected]> Co-authored-by: Mathias Petermann <[email protected]>
…#15921) (argoproj#15973) * feat(cmp): Print stderr output from command even on success Signed-off-by: Mathias Petermann <[email protected]> * docs(cmp): Document logging from cmp sidecard for development purposes Signed-off-by: Mathias Petermann <[email protected]> --------- Signed-off-by: Mathias Petermann <[email protected]>
…#15921) (argoproj#15973) * feat(cmp): Print stderr output from command even on success Signed-off-by: Mathias Petermann <[email protected]> * docs(cmp): Document logging from cmp sidecard for development purposes Signed-off-by: Mathias Petermann <[email protected]> --------- Signed-off-by: Mathias Petermann <[email protected]> Signed-off-by: Thomas Sands <[email protected]>
…15973) (#16124) * feat(cmp): Print stderr output from command even on success * docs(cmp): Document logging from cmp sidecard for development purposes --------- Signed-off-by: Mathias Petermann <[email protected]> Signed-off-by: Thomas Sands <[email protected]> Co-authored-by: Mathias Petermann <[email protected]>
…#15921) (argoproj#15973) * feat(cmp): Print stderr output from command even on success Signed-off-by: Mathias Petermann <[email protected]> * docs(cmp): Document logging from cmp sidecard for development purposes Signed-off-by: Mathias Petermann <[email protected]> --------- Signed-off-by: Mathias Petermann <[email protected]>
…#15921) (argoproj#15973) * feat(cmp): Print stderr output from command even on success Signed-off-by: Mathias Petermann <[email protected]> * docs(cmp): Document logging from cmp sidecard for development purposes Signed-off-by: Mathias Petermann <[email protected]> --------- Signed-off-by: Mathias Petermann <[email protected]> Signed-off-by: jmilic1 <[email protected]>
…#15921) (argoproj#15973) * feat(cmp): Print stderr output from command even on success Signed-off-by: Mathias Petermann <[email protected]> * docs(cmp): Document logging from cmp sidecard for development purposes Signed-off-by: Mathias Petermann <[email protected]> --------- Signed-off-by: Mathias Petermann <[email protected]>
…#15921) (argoproj#15973) * feat(cmp): Print stderr output from command even on success Signed-off-by: Mathias Petermann <[email protected]> * docs(cmp): Document logging from cmp sidecard for development purposes Signed-off-by: Mathias Petermann <[email protected]> --------- Signed-off-by: Mathias Petermann <[email protected]>
…#15921) (argoproj#15973) * feat(cmp): Print stderr output from command even on success Signed-off-by: Mathias Petermann <[email protected]> * docs(cmp): Document logging from cmp sidecard for development purposes Signed-off-by: Mathias Petermann <[email protected]> --------- Signed-off-by: Mathias Petermann <[email protected]>
Summary
Currently it's not possible to write any logs from within the commands run in the CMP sidecars.
Everything written to stdout is passed to
kubectl
while the things written to stderr are only visible if the commands fail.Motivation
To enable easier debugging it would be great to be able to write some logs from the commands within CMP.
In our setup we had a sidecar that sometimes stopped processing the repos, and we don't have a way to debug it, beside writting into a log file within the sidecar and check that from a shell.
Beeing able to write some logs from a plugin sidecar command, would be really helpful.
Proposal
One way to implement this, would be to provide an additional command for the
cmp-plugin-server
, that can be called with the log level (and thus beeing able to respect the configured log level) and the message, eg/var/run/argocd/argocd-cmp-server log --level=DEBUG --msg="Hello world"
Another alternative might be to have a pipe, that is always just written to the container logs by the cmp-server, but then the handling of the log level would need to be done by command itself, and the log level would need to be exposed to the commands somehow (or make the loglevel for the cmp-server configurable through an environment variable, that can then be read from the commands)
The text was updated successfully, but these errors were encountered: