-
Notifications
You must be signed in to change notification settings - Fork 94
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 log collection support for vanilla Kubeadm clusters #211
Conversation
KUBEADM_DIR="/etc/kubernetes/" | ||
KUBEADM_STATIC_DIR="/etc/kubernetes/manifests/" | ||
techo "Collecting k8s kubeadm cluster logs" | ||
if [ -f /$USER/.kube/config ]; 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.
It's possible that a user doesn't store the kubeconfig in this location. Can we make this configurable?
KUBECONFIG=${KUBECONFIG:-"$USER/.kube/config"}
if [ -f /$USER/.kube/config ]; then | ||
mkdir -p $TMPDIR/kubeadm/kubectl | ||
KUBECONFIG=/$USER/.kube/config | ||
/usr/bin/kubectl --kubeconfig=$KUBECONFIG get nodes -o wide > $TMPDIR/kubeadm/kubectl/nodes 2>&1 |
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.
Make kubectl binary location also configurable.
KUBECTL_CMD=${KUBECTL_CMD:-"/usr/bin/kubectl"}
/usr/bin/kubectl --kubeconfig=$KUBECONFIG cluster-info dump > $TMPDIR/kubeadm/kubectl/cluster-info_dump 2>&1 | ||
fi | ||
|
||
if [ -f /$USER/.kube/config ]; 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.
Curious, why do we have two "if" blocks?
|
||
mkdir -p $TMPDIR/kubeadm/podlogs | ||
techo "Collecting k8s kubeadm system pod logs" | ||
if [ -f /$USER/.kube/config ]; 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.
I think these if checks can be done once at the top of the function, not needed for every section.
kubeadm-etcd() { | ||
|
||
KUBEADM_ETCD_DIR="/var/lib/etcd/" | ||
KUBEADM_ETCD_CERTS="/etc/kubernetes/pki/etcd/" |
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.
Add ETCD_CMD checks. This binary might not exist on the host.
thanks @leodotcloud for reviewing and for the good suggestions. |
I appreciate your PR and am glad you could reuse some parts, but the existing code makes some assumptions and those are not applicable to your changes.
That's not how code reviews work anywhere :) Anyways, I quickly made the changes that I suggested. |
Thanks appreciated :)
I welcome your criticism but have you actually tested your modification ? :)
It's missing this part in the
I am more than happy to send a new PR to fix this |
For your use-case, you have to invoke the script with |
An automatic detection would be more appropriate for my case because the idea was to embed this script into other projects where we have mixed environments, Rancher and Kubeadm. |
This PR addresses issue/request #209
New functions created:
the switch
-r
now also includeskubeadm
as a selector from the list