Commit Graph

104 Commits

Author SHA1 Message Date
Andrew Seigner 8fe742e2de
Update Grafana dashboards to use new proxy metrics (#637)
The Top-line and Deployment Grafana dashboards relied on the
soon-to-be-removed telemetry pipeline metrics.

Update the Grafana dashboards to query for the new, proxy-based metrics.
Grafana dashboard layouts have not changed.

Depends on #635 to render metrics.

Part of #420.

Signed-off-by: Andrew Seigner <siggy@buoyant.io>
2018-03-29 13:00:01 -07:00
Andrew Seigner 666c83e963
Add pod_name to Prometheus labels (#649)
Previously we were using the instance label to uniquely identify a pod.
This meant that getting stats by pod name would require extra queries to
Kubernetes to map pod name to instance.

This change adds a pod_name label to metrics at collection time. This
should not affect cardinality as pod_name is invariant with respect to
instance.

Signed-off-by: Andrew Seigner <siggy@buoyant.io>
2018-03-29 11:07:35 -07:00
Deshi Xiao 732f3c1565 fix grafana CrashLoopBackoff on image 5.0.3 (#646)
this is a known issue with grafana in k8s. grafana/grafana:5.0.4 was just released today. update the repo from 5.0.3 to 5.0.4
fixed issues #582

Signed-off-by: Deshi Xiao <xiaods@gmail.com>
2018-03-29 09:36:11 -07:00
Oliver Gould 6e435754a1
Improve CLI docker caching (#612)
Currently, the CLI docker image copies the entire `controller`
directory, though the CLI only requires a few of its subdirectories.
This causes the CLI's docker cache to be needlessly invalidated when,
for instance, a service implementation changes.

By restricting the copied directories to `controller/{api,public,util}`,
build caching is improved.
2018-03-29 09:29:06 -07:00
Kevin Lingerfelt 59c75a73a9
Add tests/utils/scripts for running integration tests (#608)
* Add tests/utils/scripts for running integration tests

Add a suite of integration tests in the `test/` directory, as well as
utilities for testing in the `testutil/` directory.

You can use the `bin/test-run` script to run the full suite of tests,
and the `bin/test-cleanup` script to cleanup after the tests.

The test/README.md file has more information about running tests.

@pcalcado, @franziskagoltz, and @rmars also contributed to this change.

* Create TEST.md file at the root of the repo

* Update based on review feedback

* Relax external service IP timeout for GKE

* Update TEST.md with more info about different types of test runs

* More updates to TEST.md based on review feedback

Signed-off-by: Kevin Lingerfelt <kl@buoyant.io>
2018-03-27 15:06:55 -07:00
Andrew Seigner fe35509406
Clean up Prometheus labels scraped from proxy (#633)
The Prometheus scrape config collects from Conduit proxies, and maps
Kubernetes labels to Prometheus labels, appending "k8s_".

This change keeps the resultant Prometheus labels consistent with their
source Kubernetes labels. For example: "deployment" and
"pod_template_hash".

Signed-off-by: Andrew Seigner <siggy@buoyant.io>
2018-03-27 15:01:08 -07:00
Andrew Seigner 291d8e97ab
Move injected data from env var to k8s labels (#605)
The inject code detects the object it is being injected into, and writes
self-identifying information into the CONDUIT_PROMETHEUS_LABELS
environment variable, so that conduit-proxy may read this information
and report it to Prometheus at collection time.

This change puts the self-identifying information directly into
Kubernetes labels, which Prometheus already collects, removing the need
for conduit-proxy to be aware of this information. The resulting label
in Prometheus is recorded in the form `k8s_deployment`.

Signed-off-by: Andrew Seigner <siggy@buoyant.io>
2018-03-23 16:11:34 -07:00
Andrew Seigner fb1d6a5c66
Introduce Conduit Health dashboard (#591)
In addition to dashboards display service health, we need a dashboard to
display health of the Conduit service mesh itself.

This change introduces a conduit-health dashboard. It currently only
displays health metrics for the control plane components. Proxy health
will come later.

Fixes #502

Part of #420

Signed-off-by: Andrew Seigner <siggy@buoyant.io>
2018-03-22 15:16:03 -07:00
Alex Leong d50550515e
Add the proxy pod owner as a Prometheus label (#448)
Update the inject command to set a CONDUIT_PROMETHEUS_LABELS proxy environment variable with the name of the pod spec that the proxy is injected into. This will later be used as a label value when the proxy is exposing metrics.

Fixes: #426

Signed-off-by: Alex Leong <alex@buoyant.io>
2018-03-22 15:10:51 -07:00
Andrew Seigner c03508ba8c
Update Prometheus to scrape data and control plane (#583)
The existing telemetry pipeline relies on Prometheus scraping the
Telemetry service, which will soon be removed.

This change configures Prometheus to scrape the conduit proxies directly
for telemetry data, and the control plane components for control-plane
health information. This affects the output of both conduit install
and conduit inject.

Fixes #428, #501

Signed-off-by: Andrew Seigner <siggy@buoyant.io>
2018-03-22 13:58:11 -07:00
Andrew Seigner 680bf6211a
Add Grafana support to conduit dashboard command (#590)
The existing `conduit dashboard` command supported opening the conduit
dashboard, or displaying the conduit dashboard URL, via a `url` boolean
flag.

Replace the `url` boolean flag with a `show` string flag, with three
modes:
`conduit dashboard --show conduit`: default, open conduit dashboard
`conduit dashboard --show grafana`: open grafana dashboard
`conduit dashboard --show url`: display dashboard URLs

Part of #420

Signed-off-by: Andrew Seigner <siggy@buoyant.io>
2018-03-20 18:07:30 -07:00
Andy Hume e6286e1bdf cli: ensure check command has 80-character output (#587)
Successful `conduit check` commands now take into account `[ok]`
and `\n` tokens when constraining line length.

Fixes #554

Signed-off-by: Andy Hume <andyhume@gmail.com>
2018-03-20 13:55:19 -07:00
Andrew Seigner 3ca8e84eec
Add Top Line and Deployment Grafana dashboards (#562)
Existing Grafana configuration contained no dashboards, just a skeleton
for testing.

Introduce two Grafana dashboards:
1) Top Line: Overall health of all Conduit-enabled services
2) Deployment: Health of a specific conduit-enabled deployment

Fixes #500

Signed-off-by: Andrew Seigner <siggy@buoyant.io>
2018-03-20 10:22:30 -07:00
Brian Smith e7c4a9d4b9
Remove the cli docker image (#579)
This image isn't used. It references its base image using the `latest` tag, which
is wrong; it should have been using the tag that the base image was built with. It
is likely that the last few iterations of this image that we've published have
wrong and useless contents.

With that in mind, just remove the image.

Fixes #578.

Signed-off-by: Brian Smith <brian@briansmith.org>
2018-03-16 14:22:46 -10:00
Alex Leong 9eb084c99d Most controller listeners should only bind on localhost (#494)
* Most controller listeners should only bind on localhost
* Use default listening addresses in controller components
* Review feedback
* Revert test_helper change
* Revert use of absolute domains

Signed-off-by: Alex Leong <alex@buoyant.io>
2018-03-12 11:32:20 -07:00
Brian Smith 649e784d9c
Simplify cluster zone suffix handling in the proxy (#528)
* Temporarily stop trying to support configurable zones in the proxy.

None of the zone configuration is tested and lots of things assume the cluster
zone is `cluster.local`. Further, how exactly the proxy will actually learn the
cluster zone hasn't been decided yet.

Just hard-code the zone as "cluster.local" in the proxy until configurable zones
are fully implemented and tested to be working correctly.

Signed-off-by: Brian Smith <brian@briansmith.org>

* Remove the CONDUIT_PROXY_DESTINATIONS_AUTOCOMPLETE_FQDN setting

The way that Kubernetes configures DNS search suffixes has some negative
consequences as some names like "example.com" are ambiguous: depending on
whether there is a service "example" in the "com" namespace, "example.com"
may refer to an external service or an internal service, and this can
fluctuate over time. In recognition of that we added the
CONDUIT_PROXY_DESTINATIONS_AUTOCOMPLETE_FQDN setting, thinking this would
be part of a solution for users to opt out of the unfortunate behavior
if their applications didn't depend on the DNS search suffix feature.

It turns out similar effects can be acheived using a custom dnsConfig,
starting in Kubernetes 1.10 when dnsConfig reaches the beta stability level.
Now any CONDUIT_PROXY_DESTINATIONS_AUTOCOMPLETE_FQDN-based seems duplicative.
Further, attempting to support it optionally made the code complex and hard
to read.

Therefore, let's just remove it. If/when somebody actually requests this
functionality then we can add it back, if dnsConfig isn't a valid alternative
for them.

Signed-off-by: Brian Smith <brian@briansmith.org>

* Further hard-code "cluster.local" as the zone, temporarily.

Addresses review feedback.

Signed-off-by: Brian Smith <brian@briansmith.org>
2018-03-07 14:30:13 -10:00
Dennis Adjei-Baah ad42f2f8ab
Retry k8s watch endpoints on error (#510)
Shortly after conduit is installed in k8s environment. The control plane component that establishes a watch endpoint with k8s run in to networking issues during proxy initialization. During failure, each watcher fails to retry its connection to k8s watch endpoint which leads to timeouts and eventually, multiple controller pod restarts.

This PR adds retry logic to each "watch" enabled package.

fixes #478

Signed-off-by: Dennis Adjei-Baah <dennis@buoyant.io>
2018-03-07 13:40:43 -08:00
Brian Smith 0d4ab39ce7
Revert "Make absolute names truly absolute. (#525)" (#533)
This reverts commit 517616a166.

Signed-off-by: Brian Smith <brian@briansmith.org>
2018-03-07 10:57:10 -10:00
Brian Smith 517616a166
Make absolute names truly absolute. (#525)
Kubernetes will do multiple DNS lookups for a name like
`proxy-api.conduit.svc.cluster.local` based on the default search settings
in /etc/resolv.conf for each container:

1. proxy-api.conduit.svc.cluster.local.conduit.svc.cluster.local. IN A
2. proxy-api.conduit.svc.cluster.local.svc.cluster.local. IN A
3. proxy-api.conduit.svc.cluster.local.cluster.local. IN A
4. proxy-api.conduit.svc.cluster.local. IN A

We do not need or want this search to be done, so avoid it by making each
name absolute by appending a period so that the first three DNS queries
are skipped for each name.

The case for `localhost` is even worse because we expect that `localhost` will
always resolve to 127.0.0.1 and/or ::1, but this is not guaranteed if the default
search is done:

1. localhost.conduit.svc.cluster.local. IN A
2. localhost.svc.cluster.local. IN A
3. localhost.cluster.local. IN A
4. localhost. IN A

Avoid these unnecessary DNS queries by making each name absolute, so that the
first three DNS queries are skipped for each name.

Signed-off-by: Brian Smith <brian@briansmith.org>
2018-03-07 09:46:03 -10:00
Kevin Lingerfelt 47fc2eae20
Set -logtostderr flag on controller components (#524)
Signed-off-by: Kevin Lingerfelt <kl@buoyant.io>
2018-03-07 10:18:15 -08:00
Andrew Seigner a065174688
Disable Grafana update check (#521)
Grafana by default calls out to grafana.com to check for updates. As
user's of Conduit do not have direct control over updating Grafana
directly, this update check is not needed.

Disable Grafana's update check via grafana.ini.

This is also a workaround for #155, root cause of #519.

Signed-off-by: Andrew Seigner <siggy@buoyant.io>
2018-03-06 16:14:44 -08:00
Kevin Lingerfelt d6bd17425a
Add --expected-version flag for conduit check command (#497)
* Add --expected-version flag for conduit check command

Signed-off-by: Kevin Lingerfelt <kl@buoyant.io>

* Update build instructions

Signed-off-by: Kevin Lingerfelt <kl@buoyant.io>
2018-03-06 11:32:14 -08:00
Dennis Adjei-Baah 5a4c5aa683
Exclude telemetry generated by the control plane when requesting depl… (#493)
When the conduit proxy is injected into the controller pod, we observe controller pod proxy stats show up as an "outbound" deployment for an unrelated upstream deployment. This may cause confusion when monitoring deployments in the service mesh.

This PR filters out this "misleading" stat in the public api whenever the dashboard requests metric information for a specific deployment.

* exclude telemetry generated by the control plane when requesting deployment metrics

fixes #370

Signed-off-by: Dennis Adjei-Baah <dennis@buoyant.io>
2018-03-05 17:58:08 -08:00
Brian Smith 4c9b9c0f68
Install: Don't install buoyantio/kubectl into the prometheus pod. (#509)
In the initial review for this code (preceding the creation of the
runconduit/conduit repository), it was noted that this container is not
actually used, so this is actually dead code.

Further, this container actualy causes a minor problem, as it doesn't
implement any retry logic, thus it will sometimes often cause errors to
be logged. See
https://github.com/runconduit/conduit/issues/496#issuecomment-370105328.

Further, this is a "buoyantio/" branded container. IF we actually need
such a container then it should be a Conduit-branded container.

See https://github.com/runconduit/conduit/issues/478 for additional
context.

Signed-off-by: Brian Smith <brian@briansmith.org>
2018-03-05 08:59:14 -10:00
Igor Zibarev 0f6db6efc0 cli: refactor k8s config to support $KUBECONFIG with multiple paths (#482)
Kubernetes $KUBECONFIG environment variable is a list of paths to
configuration files, but conduit assumes that it is a single path.

Changes in this commit introduce a straightforward way to discover and
load config file(s).

Complete list of changes:

- Use k8s.io/client-go/tools/clientcmd to deal with kubernetes
configuration file
- rename k8s API and k8s proxy constructors to get rid of redundancy
- remove shell package as it is not needed anymore

Signed-off-by: Igor Zibarev <zibarev.i@gmail.com>
2018-02-28 12:13:09 -08:00
Andrew Seigner d50c8b4ac8
Add Grafana to conduit install (#444)
`conduit install` deploys prometheus, but lacks a general-purpose way to
visualize that data.

This change adds a Grafana container to the `conduit install` command. It
includes two sample dashboards, viz and health, in their own respective
source files.

Part of #420

Signed-off-by: Andrew Seigner <siggy@buoyant.io>
2018-02-28 11:36:21 -08:00
Andy Hume 1e611c21c6 cli: add check for latest version of cli and control plane (#460)
As part of `conduit check` command, warn the user if they are
running an outdated version of the cli client or the control
plane components.

Fixes #314

Signed-off-by: Andy Hume <andyhume@gmail.com>
2018-02-27 16:11:38 -08:00
Dennis Adjei-Baah 893bacf8d6
Make prometheus URL in config fully qualified DNS name (#443)
The telemetry service in the controller pod uses a non-fully qualified URL to connect to the prometheus pod in the control plane. This PR changes the URL the telemetry's prometheus URL to be fully qualified to be consistent with other URLs in the control plane. This change was tested in minikube. The logs report no errors and looking at the prometheus dashboard shows that stats are being recorded from all conduit proxies.

fixes #414

Signed-off-by: Dennis Adjei-Baah dennis@buoyant.io
2018-02-26 09:40:31 -08:00
Brian Smith 34cf79a3e6
Add a test of the actual default output of `conduit install`. (#376)
Refactor `conduit install` test into a data-driven test. Then add a test of the actual default output of `conduit install`.

This test is useful to make it clear when we change the default
settings of `conduit install`.

Signed-off-by: Brian Smith <brian@briansmith.org>
2018-02-23 13:27:36 -10:00
Brian Smith 78ebd5e340
Base control plane Docker images on scratch instead of base. (#368)
The control plane is proxied through the Conduit proxy. The Conduit
proxy is based on the base image, and the control plane containers
and the proxy share a networking namespace. This means we don't
need the extra base utilities in the controller images since we can
use the utilties in the proxy image.

This is a step towards building the initial no-networking Conduit CA
pod. Since the Conduit CA will not do any networking of its own, we
networking debugging utilties are not helpful for it. They are
actually an unnecessary risk because they could facilitate the
exfiltration of the private key of the CA. (The Conduit CA pod won't
have the Conduit Proxy injected into it either.)

This also simplifies & slightly speeds up the building of the
controller images. This is a stepping stone towards being able to
build the controller images without `docker build` to improve build
times.

Signed-off-by: Brian Smith <brian@briansmith.org>
2018-02-23 13:03:19 -10:00
Brian Smith 86bb65a148
Remove potentially-conflicting `app` labels in control plane (#373)
The `app` label should be reserved for end-user applications and we
shouldn't use it ourselves. We already have a Conduit-specific label
that is is prefixed with the `conduit.io/` prefix to avoid naming
collisions with users' labels, so just use that one instead.

Signed-off-by: Brian Smith <brian@briansmith.org>
2018-02-23 12:43:55 -10:00
Andrew Seigner 83f9c391bb
Move install template to its own file (#423)
The template used by `conduit install` was hard-coded in install.go.

This change moves the template into its own file, in anticipation of
increasing the template's size and complexity.

Part of #420

Signed-off-by: Andrew Seigner <siggy@buoyant.io>
2018-02-23 14:15:31 -08:00
Dennis Adjei-Baah f66ec6414c
Inject the conduit proxy into controller pod during conduit install (#365)
In order to take advantage of the benefits the conduit proxy gives to deployments, this PR injects the conduit proxy into the control plane pod. This helps us lay the groundwork for future work such as TLS, control plane observability etc.

Fixes #311

Signed-off-by: Dennis Adjei-Baah <dennis@buoyant.io>
2018-02-23 13:55:46 -08:00
Brian Smith cf3c8cd7bc
Use Go 1.10.0 to build Go components. (#408)
* Use Go 1.10.0 to build Go components.

Take advantage of the new build cache in Go 1.10. Future work on improving
build performance will utilize the build cache further.

Signed-off-by: Brian Smith <brian@briansmith.org>
2018-02-21 14:31:29 -10:00
Brian Smith e6aad57766
Remove temporary files generated by dep in go-deps image. (#407)
Previously Dockerfile-go-deps was converted from a multi-stage Dockefile
to a single-stage Dockerfile in anticipation of enabling efficient use
of `--cache-from` in CI. However, that resulted in the image ballooning
in size because it contained the Git repo for every package downloaded
by `dep ensure`.

Bring the image back down to the proper size by removing the temporary
files created.

Signed-off-by: Brian Smith <brian@briansmith.org>
2018-02-21 13:06:24 -10:00
Kevin Lingerfelt c579a8fe8d
Improve get/stat/tap help text by way of examples (#401)
Signed-off-by: Kevin Lingerfelt <kl@buoyant.io>
2018-02-20 19:27:42 -08:00
Kevin Lingerfelt 8db7115420
Update go-run to set version equal to root-tag (#393)
* Update go-run to set version equal to root-tag

* Fix inject tests for undefined version change

* Pass inject version explitictly as arg

Signed-off-by: Kevin Lingerfelt <kl@buoyant.io>
2018-02-20 12:25:55 -08:00
Kevin Lingerfelt f48555d3cc
Remove kubectl dependency, validate k8s server version via api (#396)
* Remove kubectl dependency, validate k8s server version via api

Signed-off-by: Kevin Lingerfelt <kl@buoyant.io>

* Remove unused MockKubectl

Signed-off-by: Kevin Lingerfelt <kl@buoyant.io>

* Remame kubectl.go to version.go

Signed-off-by: Kevin Lingerfelt <kl@buoyant.io>
2018-02-20 12:14:11 -08:00
Dennis Adjei-Baah 9af3783555
Print error message only when invalid YAML file is used with inject command (#389)
When the `inject` command is used on a YAML file that is invalid, it prints out an invalid YAML file with the injected proxy. This may give a false indication to the user that the inject was successful even though the inject command prints out an error message further down the terminal window. This PR fixes #303 and contains a test input and output file that indicates what should be shown.

This PR also fixes #390.
Signed-off-by: Dennis Adjei-Baah <dennis@buoyant.io>
2018-02-20 11:59:41 -08:00
Kevin Lingerfelt d1ae4c5bc7
Run conduit dashboard on ephemeral port by default (#394)
* Run conduit dashboard on ephemeral port by default

* Fix wording on dashboard --port flag

* log.Debug error instead of discarding it

Signed-off-by: Kevin Lingerfelt <kl@buoyant.io>
2018-02-20 10:33:47 -08:00
Brian Smith 1489a84316
Refactor `conduit inject` code to eliminate duplicate logic (#383)
* Refactor `conduit inject` code to eliminate duplicate logic

Previously there was a lot of code repeated once for each type of
object that has a pod spec.

Refactor the code to reduce the amount of duplication there, to make future
changes easier.

Signed-off-by: Brian Smith <brian@briansmith.org>
2018-02-19 11:18:44 -10:00
Brian Smith 80aba6c075
CLI: Remove now-unnecessary "enhanced" Kubernetes object types (#382)
* CLI: Remove now-unnecessary "enhanced"  Kubernetes object types

The "enhanced" types aren't necessary because now the Kuberentes API
implementation has the correct JSON annotations for the InitContainers
field.

Signed-off-by: Brian Smith <brian@briansmith.org>
2018-02-19 09:37:25 -10:00
Risha Mars 8bc7c5acde
UI tweaks: sidebar collapse, latency formatting, table row spacing (#361)
- reduce row spacing on tables to make them more compact
- Rename TabbedMetricsTable to MetricsTable since it's not tabbed any more
- Format latencies greater than 1000ms as seconds
- Make sidebar collapsible 
- poll the /pods endpoint from the sidebar in order to refresh the list of deployments in the autocomplete
- display the conduit namespace in the service mesh details table
- Use floats rather than Col for more responsive layout (fixes #224)
2018-02-19 11:21:54 -08:00
Dennis Adjei-Baah 01e694ad71
add check and friendly error if conduit dashboard is not installed (#289)
* add check and friendly error if conduit dashboard is not installed

Signed-off-by: Dennis Adjei-Baah <dennis@buoyant.io>
2018-02-19 09:28:56 -08:00
Brian Smith d8f9c33183
Skip pods with hostNetwork=true in `conduit inject` (#380)
The init container injected by conduit inject rewrites the iptables configuration for its network namespace. This causes havoc when the network namespace isn't restricted to the pod, i.e. when hostNetwork=true.

Skip pods with hostNetwork=true to avoid this problem.

Fixes #366.

Signed-off-by: Brian Smith <brian@briansmith.org>
2018-02-18 13:55:42 -10:00
Brian Smith 51873542e5
Refactor `conduit inject` code to make it unit-testable. (#379)
Refactor `conduit inject` code to make it unit-testable.

Refactor the conduit inject code to make it easier to add unit tests. This work was done by @deebo91 in #365. This is the same PR without the conduit install changes, so that it can land ahead of #365. In particular, this will be used for testing the fix for high-priority bug #366.

Signed-off-by: Dennis Adjei-Baah <dennis@buoyant.io>
Signed-off-by: Brian Smith <brian@briansmith.org>
2018-02-18 12:33:52 -10:00
Brian Smith 64f270b631
Strip `conduit` CLI executables in `docker build`. (#367)
File sizes (in bytes) before and after this change:

        conduit-darwin conduit-linux conduit-windows
Before:     27,056,288    27,282,364      27,359,744
After:      20,023,456    18,080,576      18,262,528
----------------------------------------------------
Diff         7,032,832     9,201,788       9,097,216

Fixes #352.

Signed-off-by: Brian Smith <brian@briansmith.org>
2018-02-16 08:20:18 -10:00
Brian Smith b18fe459d4
Precompile large Go libraries in go-deps Docker image. (#332)
On my system (i9-7960x running Docker natively in Linux) this regularly saves
over 11 seconds of build time when a file under pkg/ changes and over 1.5
seconds of build time when a file under controller/ changes. Since most
contributors are running Docker in a VM on less powerful computers, the
savings for most contributors should be significantly greater.

I imagine the savings for web/ and cli/ and proxy-init/ are similar, but I
did not measure them.

Signed-off-by: Brian Smith <brian@briansmith.org>
2018-02-13 11:35:10 -10:00
Andrew Seigner 797bba6bc6
Upgrade to Prometheus 2.1.0 (#344)
Conduit has been on Prometheus 1.8.1. Prometheus 2.x promises better
performance.

Upgrade Conduit to Prometheus 2.1.0

Signed-off-by: Andrew Seigner <siggy@buoyant.io>
2018-02-13 13:22:53 -08:00
Brian Smith ec5a02fd64
Upgrade to Go 1.9.4. (#326)
Go 1.9.4 is a security release.

Signed-off-by: Brian Smith <brian@briansmith.org>
2018-02-12 13:47:40 -10:00