Commit Graph

789 Commits

Author SHA1 Message Date
Bryan Boreham
80dbd3443c probe: Add -probe.publish.stdout option for debugging
This option gives a crude way to view the raw probe data as json in
the container logs, so that you can check exactly what it would have
sent.

We stub out the PipeClient interface with a dummy implementation in
this mode.
2018-06-19 22:59:01 +00:00
Bryan Boreham
06c895267c Reports: streamline report serialization
Move the creation of the buffer and the choice of compression level
(which never changes) into WriteBinary(), to simplify the code.
2018-06-19 22:59:01 +00:00
Bryan Boreham
56137211b5 probe: Eliminate appclient.reportPublisher
Simplification: move the 'noControls' functionality into the probe, as
we don't need a whole struct to do that.

The ReportPublisher interface also moves into probe where it belongs:
"the consumer should define the interface" - Dave Cheney
2018-06-19 22:59:01 +00:00
Bryan Boreham
96f51c47af probe: Eliminate Publisher interface from app_client
Simplification: everything now implements Publish(Report), and we do
away with writing/reading/writing in the MultiAppClient.
2018-06-19 22:51:25 +00:00
Bryan Boreham
8c18a785e7 Merge pull request #3132 from openebs/add-pv-pvc-support
Add Kubernetes Storage (pv and pvc) support in Weave Scope
2018-06-08 12:41:21 +01:00
Satyam Zode
d9bd17af8a Refactor edge frontend code and reporter
- Refactor dotted edge logic.
- Change Storage view to show storage components as well as all
  the pods.
- Sentence case storage related variables.

Signed-off-by: Satyam Zode <satyam.zode@openebs.io>
2018-06-08 16:37:48 +05:30
Satyam Zode
24741bec2a Simplify volume rendering code in render
- Remove the complex volume rendering code.
- Remove volume specific code from Transform.
- Rename filtering methods
- Remove extra params from PV, PVC nodes to make table view look good.

Signed-off-by: Satyam Zode <satyam.zode@openebs.io>
2018-06-08 16:37:42 +05:30
Satyam Zode
d26b2c3805 Add Kubernetes storage class resource to weave scope
This will:

- Add StorageClass resource. Storage classes are mentioned
in the PVC spec. We're using storage class name from PVC spec to
add adjacency to the PVC node.
- Add square sheet shape for StorageClass.
- Add storage filter in the PODS topology.
Storage Filter will allow user to see distinct view of
stateful applications.
- Add visually distinct edge to show storage adjacency.

Signed-off-by: Satyam Zode <satyam.zode@openebs.io>
2018-06-08 16:36:29 +05:30
Satyam Zode
2f69973de6 Add adjacencies for kubernetes storage components
- Kubernetes storage components such as PV and PVC are connected based on two
parameters Persistent volume claim name and Persistent Volume name.
- PVC contains the volume name which is, PV name itself. Hence, we can
show edge for PVC and PV.
- This will bring higher level visibility for kubernetes storage components.

Signed-off-by: Satyam Zode <satyam.zode@openebs.io>
2018-06-07 17:04:56 +05:30
Satyam Zode
23210a6a77 Add Kubernetes volumes support in Weave Scope
This will

- Add Kubernetes volume resources such as PV, PVC.
- Add shapes for Kubernetes PV and PVC
- Add `Cylinder` shape for PV and `Dotted Cylinder` shape for PVC.

Signed-off-by: Satyam Zode <satyam.zode@openebs.io>
2018-06-07 17:01:29 +05:30
Bryan Boreham
009af5be0c Probe: remove backwards-compatibility code when publishing reports
Removed to reduce CPU and memory usage in probes.

This code was added in August 2016 so that newer probes could be used
with older apps. Since then we have adopted the stance that new apps
will accept reports from old probes but not vice-versa, on a version
change.
2018-06-05 16:47:23 +00:00
Bryan Boreham
20ce708db9 Don't bother deduplicating IPs; they end up in a set 2018-06-04 16:41:24 +00:00
Bryan Boreham
c6c51f36f7 Limit network namespace code to compile on Linux only 2018-06-04 10:54:02 +00:00
Bryan Boreham
ade54ba84e probe: stop calling 'weave ps'
Now that we enter the container namespace to fetch IPs for every
container, there is no need to have 'weave ps' do it.

This does mean we lose Weave MAC addresses, but that is a rather
idiosyncratic feature anyway.
2018-06-02 22:22:08 +00:00
Bryan Boreham
ff5b2affe0 probe: fetch container IP addresses from inside its namespace
So that we can pick up addresses added via CNI or other mechanisms
that Docker is not aware of.
2018-06-02 21:49:30 +00:00
Michael Schubert
7bb1e38de3 ebpf: update check for known faulty Ubuntu kernels
With c75700fe04 we added code to detect
Ubuntu Xenial kernels with a regression in the eBPF subsystem in order
to gently fallback to procfs scanning on such systems (and not crash the
host system by running eBPF code).

With the latest kernel update for Ubuntu Xenial, the bug was fixed:

https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1763454

Therefore we can update the added check with an upper limit and make
sure that eBPF connection tracking only is disabled on kernels within
the range having the bug.

xref: https://github.com/weaveworks/scope/issues/3131
2018-05-23 11:38:04 +02:00
Stefan Prodan
439b67880e Fix pause image detection for Kubernetes 1.10 2018-05-19 14:03:17 +03:00
Roland Schilter
f012c23ca1 Sentence cased text everywhere (#3166)
* Sentence cased text everywhere

Follows Weave Cloud's direction of sentence case on most things.

* More space between sorter caret and label

* Use full topology name for table header
2018-05-17 17:30:38 -07:00
Filip Barl
bfb20a8f40 Addressed @LiliC's feedback. 2018-05-17 11:43:54 +02:00
Filip Barl
183aaea950 Fixed the tests. 2018-05-17 11:09:31 +02:00
Filip Barl
4382deb39b Show image tag separate from image name in Node Details. 2018-05-17 11:09:31 +02:00
Michael Schubert
5d036c5ac4 ebpf: add tests for isKernelSupported() 2018-04-13 17:17:51 +02:00
Michael Schubert
c75700fe04 ebpf: check for known faulty Ubuntu kernel
The Ubuntu Xenial update to kernel 4.4.0-119.143 from 4.4.0-116.140 did
include a regression in the eBPF code. A basic `bpf_map_lookup_elem`
call as found in the tcptracer-bpf library used by Scope leads to a
kernel panic. As a result, Scope / the system crashes during startup
when the tcptracer is initialized. The Scope bug report can be found
here:

https://github.com/weaveworks/scope/issues/3131

To avoid crashes and gently fallback to procfs (as Scope already does
for systems not supporting eBPF), update `isKernelSupported()` and
explicitly check for Ubuntu Kernel versions with the problem.

Once the bug is fixed and an update published, the `abiNumber` check in
`isKernelSupported()` can and should be updated with an upper limit.

The Ubuntu bug report can be found here:

https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1763454
2018-04-13 17:17:51 +02:00
Matthias Radestock
805572d70e refactor: inline single-use constant 2018-04-02 13:50:22 +01:00
Matthias Radestock
e852b18e42 refactor: remove unused constant 2018-04-02 13:48:29 +01:00
Matthias Radestock
feae4f4fcf don't show Failed pods
these are not alive, and Scope generally only shows the living, not
the dead.
2018-04-02 11:03:25 +01:00
Matthias Radestock
27fb3571e1 refactor: remove StateDeleted from map keys
since it is a map value, not a key.
2018-04-02 11:03:01 +01:00
Matthias Radestock
076acdb319 send shortcut reports on all container state changes
This got broken in cec750049f.
2018-03-25 09:08:45 +01:00
Roland Schilter
3de06b5a09 Support controls in more k8s topologies (#3110)
* Refactor: func has already access to probeID

* Allow controls for more k8s topologies

Controls for nodes generally need to know about the probe that is in
control of them.

This PR appends the probe ID info to k8s topologies CronJob, DaemonSet,
Service, and StatefulSet. Therefore allowing plugins to append controls.

* Remove superfluous error check

* Add some tests to verify controls allowance
2018-03-16 12:39:57 -07:00
Matthias Radestock
adc46e84e8 Merge pull request #3094 from weaveworks/remove-getchildren
Remove unused process tree function GetChildren()
2018-02-26 13:43:29 +00:00
Bryan Boreham
262cea2797 More efficient docker Tagger
Augment existing node rather than creating a new one then merging it,
and avoid creating a set with one entry.
2018-02-26 12:43:00 +00:00
Bryan Boreham
6593720472 Merge pull request #3080 from weaveworks/stop-polling-k8s
Remove flag -probe.kubernetes.interval and stop re-syncing Kubernetes data
2018-02-26 10:43:43 +00:00
Bryan Boreham
95359a70d0 Merge pull request #3091 from weaveworks/omit-empty-networks
Exclude null entries for networks on container nodes in probe report
2018-02-26 10:43:13 +00:00
Bryan Boreham
c06429b92a Remove unused process tree function GetChildren() 2018-02-26 08:54:31 +00:00
Bryan Boreham
64570f1311 Add Kubernetes service type and ports 2018-02-24 14:58:13 +00:00
Bryan Boreham
3941424794 Don't add null entries to container nodes for networks
or the "none" network, which is a special case meaning none.
2018-02-23 18:09:18 +00:00
Bryan Boreham
1de6d9755a Remove -probe.kubernetes.interval flag entirely 2018-02-22 15:05:20 +00:00
Bryan Boreham
b5cdcb9a42 Move DNS name mapping from endpoint to report 2018-02-20 16:14:21 +00:00
Bryan Boreham
6674ff61e5 Fix incorrect comment 2018-02-20 16:14:20 +00:00
Bryan Boreham
b742846835 Optimise processTopology() (#3074)
* Add a benchmark for processprocessTopology()

* Shortcut merging with an empty set

* Use more efficient apis to create process node
2018-02-19 10:13:58 +00:00
Bryan Boreham
f72ced3380 Add topology.ReplaceNode() for efficiency (#3073)
* Add topology.ReplaceNode() for efficiency

In some places AddNode() was called after adding to an existing node,
in which case the Merge() is just a waste of time.
2018-02-19 10:13:31 +00:00
Matthias Radestock
5b30b668ae refactor: don't return receiver in Topology.AddNode()
This had little use and was obscuring the mutating nature of
AddNode().
2018-02-19 05:10:04 +00:00
Brice Fernandes
e106568dda Create README.md 2018-02-15 10:36:49 +00:00
Roberto Bruggemann
37771a0607 Create reflectors asynchronously
Reflectors are created and run within the same function, asynchronously from the main thread.
Creating reflectors may require calls to the kubernetes api, which can return errors.
API errors are not handled in the main thread, but are handled asynchronously by retries.
2018-02-05 12:01:59 +00:00
Roberto Bruggemann
f4b55b3cf0 Fetch cronjobs from 'batch/v1beta1'
This applies if kubernetes' version is >= 1.8.
Otherwise fetch cronjobs from 'batch/v2alpha1'.
2018-01-30 17:04:32 +00:00
Roberto Bruggemann
710d665c41 Upgrade k8s.io/client-go to kubernetes-1.9.1
Upgraded from 99c19923, branch release-3.0.

This required fetching or upgrading the following:
* k8s.io/api to kubernetes-1.9.1
* k8s.io/apimachinery to kubernetes-1.9.1
* github.com/juju/ratelimit to 1.0.1
* github.com/spf13/pflag to 4c012f6d

Also, update Scope's imports/function calls to be compatible with the new client.
2018-01-30 10:14:42 +00:00
Roberto Bruggemann
2f9e2fc9ce Check if k8s resources are supported in runReflectorUntil
`isResourceSupported` checks whether a kubernetes resource is supported by the api server.
This ensures that, if the probe is unable to communicate with the api server, the call is retried until a true/false response.

If `isResourceSupported` returns false, `ListAndWatch` is not called and `runReflectorUntil` just exits.
2018-01-22 13:46:55 +00:00
Roberto Bruggemann
9198f6b38b logReadCloser: ensure loop terminates if channels are closed
Adding the !EOF check to the loop condition ensures not reading from closed channels.
2018-01-19 14:23:13 +00:00
Roberto Bruggemann
d1d370ce01 logReadCloser: ensure reader errors yield EOF
This change makes the underlying reader set their corresponding `eof` slot to true on termination.
This make the overall logReadCloser converge to EOF in case of errors of the underlying readers, therefore prevent spinning on read.

`bufio.Reader.ReadBytes` may not return io.EOF when `Close()` closes the underlying reader.
For instance, closing logReadCloser from the Scope App makes `bufio.Reader.ReadBytes` produce the following error: `http2: response body closed`.
2018-01-19 14:13:29 +00:00
Roberto Bruggemann
f42e22098e Merge pull request #3014 from weaveworks/stop-fetching-replicasets
Stop fetching ReplicaSets and ReplicationControllers
2018-01-15 10:33:30 +00:00