werf / kubedog

Library to watch and follow kubernetes resources in CI/CD deploy pipelines
Apache License 2.0
649 stars 43 forks source link

No logs if namespace is empty #130

Open n0madic opened 5 years ago

n0madic commented 5 years ago

The tracker does not display logs if the namespace is empty (default)

Reproduce the problem:

$ kubedog follow deployment example -n ''
# deploy/example appears to be ready
# deploy/example new rs/example-5795c486d added
# deploy/example rs/example-7d5d8f9446 added
# deploy/example rs/example-5764c48d46 added
# deploy/example rs/example-5795c486d(new) po/example-5795c486d-69pfb added
# deploy/example event: po/example-5795c486d-69pfb Killing: Stopping container kube-state-metrics
# deploy/example rs/example-5795c486d(new) po/example-5795c486d-8hwvz added
# deploy/example event: po/example-5795c486d-8hwvz Pulled: Container image "k8s.gcr.io/kube-state-metrics:v1.5.0" already present on machine
# deploy/example event: po/example-5795c486d-8hwvz Created: Created container kube-state-metrics
# deploy/example event: po/example-5795c486d-8hwvz Started: Started container kube-state-metrics
# deploy/example become READY
distorhead commented 5 years ago

Hello, thanks for reporting!

By the way follow tracker is deprecated, it is better to use multitracker: https://github.com/flant/kubedog#multitracker-cli. It has a minimal viable cli support thought and namespace should be specified fully also. I think this problem also affects multitracker.

n0madic commented 5 years ago

hmm, it seems the multitracker does not show logs at all ...

distorhead commented 5 years ago

Pods logs (logs from program, not kube events) are shown by default and kube events and other system stuff is not shown by default. Try option ShowServiceMessages to show system messages:

cat << EOF | kubedog multitrack
{
  "Deployments": [
    {
      "ResourceName": "mydeploy22",
      "Namespace": "myns"
      "ShowServiceMessages": true,
    }
  ]
}
EOF

There are many options available for multitracker: https://github.com/flant/kubedog/blob/master/pkg/trackers/rollout/multitrack/multitrack.go#L57 (for now source code is the documentation).

n0madic commented 5 years ago

I missed "Namespace" :)