Commit Graph

56 Commits

Author SHA1 Message Date
Lucas Servén Marín 50fbc2eec2
staticcheck (#313)
* CI: use staticcheck for linting

This commit switches the linter for Go code from golint to staticcheck.
Golint has been deprecated since last year and staticcheck is a
recommended replacement.

Signed-off-by: Lucas Servén Marín <lserven@gmail.com>

* revendor

Signed-off-by: Lucas Servén Marín <lserven@gmail.com>

* cmd,pkg: fix lint warnings

Signed-off-by: Lucas Servén Marín <lserven@gmail.com>
2022-05-19 19:45:43 +02:00
leonnicolas 213688fd7d
Update autogenerated code and CRD
Also edit Makefile to generate valid manifest.

Signed-off-by: leonnicolas <leonloechner@gmx.de>
2022-04-23 11:39:37 +02:00
leonnicolas 6491d7b87f
Bump go and container base image
- bump golang 1.17 -> 1.18
 - bump alpine 3.14 -> 3.15
 - revendor

 We need to use golang instead of golang:alpine because it does not
 contain git anymore. This should be fine as we are not enabling CGO,
 thus not linking against musl instead of libc.

Signed-off-by: leonnicolas <leonloechner@gmx.de>
2022-04-21 21:35:54 +02:00
Lucas Servén Marín a385f1ac82
.github: ensure docs are up to date in CI
This commit updates the CI configuration for Kilo to ensure that the
documentation, specifically the generated docs, are up-to-date.

Signed-off-by: Lucas Servén Marín <lserven@gmail.com>
2022-04-20 16:11:07 +02:00
leonnicolas 0dfb744630
kgctl connect (#269)
* kgctl connect

Use kgctl connect to connect your laptop to a cluster.

Signed-off-by: leonnicolas <leonloechner@gmx.de>

* cmd/kgctl: finish connect command

This commit fixes some bugs and finishes the implementation of the
`kgctl connect` command.

Signed-off-by: Lucas Servén Marín <lserven@gmail.com>

* e2e: add tests for kgctl connect

Signed-off-by: Lucas Servén Marín <lserven@gmail.com>

* docs: add documentation for `kgctl connect`

Signed-off-by: Lucas Servén Marín <lserven@gmail.com>

* pkg/mesh: move peer route generation to mesh

Signed-off-by: Lucas Servén Marín <lserven@gmail.com>

Co-authored-by: Lucas Servén Marín <lserven@gmail.com>
2022-04-08 13:42:13 +02:00
leonnicolas fb70091169
Makefile: remove extra line in Makefile
Signed-off-by: leonnicolas <leonloechner@gmx.de>
2021-10-20 22:29:10 +02:00
leonnicolas bb3554a3c6
Apply suggestions from code review
Co-authored-by: Lucas Servén Marín <lserven@gmail.com>
2021-10-20 22:25:05 +02:00
leonnicolas edb8f63848
Add WireGuard monitor and docs
This commit adds a manifest for deploying a WireGuard prometheus
exporter, Role and RoleBinding for kube-prometheus to monitor the Kilo
namespace and a new guide in the docs about how to monitor Kilo.

Signed-off-by: leonnicolas <leonloechner@gmx.de>
2021-10-19 22:46:44 +02:00
leonnicolas 70d2751030
bumg golang 1.15 -> 1.17
Signed-off-by: leonnicolas <leonloechner@gmx.de>
2021-09-30 17:47:47 +02:00
Steffen Vogel 1b5ad035d9
kg: add new handler for rendering the topology graph
docker: add missing fonts for rasterized graphviz  output formats

add missing license header

kg: do not export handlers

use http package for status codes

keep checks for errors in a single line

simplify error message about failed invocation of dot

pass node hostname and subnet to graph handler

use SVG as default format for graph handler

register health handler with HandleFunc

add option for selecting layout to graph handler and using circo as new default

e2e: add tests for HTTP handlers

e2e: fix and simplify handler tests

add should comments to assertions

e2s: use assert_fail instead of assert _not

add missing mime-type header for graph handler

use switch/case statements for validating formats / layouts

e2e: fix handlers tests

Co-authored-by: leonnicolas <60091705+leonnicolas@users.noreply.github.com>

graph-handler: add missing font to Dockerfile

Dockerfile: remove unnecessary font

This commit leaves Noto as the only font package, as one font package is
sufficient for the container.

Signed-off-by: Lucas Servén Marín <lserven@gmail.com>
2021-08-18 14:04:44 +02:00
Lucas Servén Marín 19b0797ae2
e2e: test multi-cluster connectivity
This commit adds a new test suite to the e2e tests that validates
multi-cluster connectivity in Kilo. This is really just an extension of
the testing of the Peers CRD and related tooling that also exercises the
`--allowed-ips` flag of the `kgctl` tool.

Signed-off-by: Lucas Servén Marín <lserven@gmail.com>
2021-07-08 11:59:32 +02:00
Lucas Servén Marín 8c7e58a231
Makefile: allow filtering e2e tests
This commit enables the filtering of e2e tests that should be run when
using the Makefile's `e2e` target through the specification of the
`BASH_UNIT_FLAGS` environment variable. The value of this variable will
be passed as arguments to the `bash_unit` command, enabling filtering of
tests.

Signed-off-by: Lucas Servén Marín <lserven@gmail.com>
2021-07-08 11:50:49 +02:00
Lucas Servén Marín c9e4786893
e2e: reuse kind cluster across suites
Currently, each test suite spins up its own kind cluster, which results
in longer e2e test times as each test suite needs to wait for the
cluster to be ready and for images to download. This commit creates two
new virtual test suites that are run before and after the actual e2e
tests and are responsible for creating and destroying a kind cluster
respectively. Any test suite that needs a fresh cluster can still spin
up its own using the `create_cluster` helper in the lib.sh file.

Signed-off-by: Lucas Servén Marín <lserven@gmail.com>
2021-07-05 19:43:18 +02:00
Lucas Servén Marín 821180bdf1
Makefile: fix e2e tests
We seem to be running into
https://github.com/kubernetes-sigs/kind/issues/2240: kube-proxy is
crashlooping, which in turn causes CoreDNS to fail to connect to the API
server over the Service CIDR, which in turn cases DNS resolution to fail
in the cluster, which in turn causes the e2e tests to fail.
To address this,
this commit bumps the kind version to 0.11.1.

Signed-off-by: Lucas Servén Marín <lserven@gmail.com>
2021-07-05 19:16:30 +02:00
Lucas Servén Marín f3eac80675
e2e: split e2e tests into different suites
This commit splits the e2e tests into different suites that all reuse
helper functions from the lib.sh file. This split ensures that the tests
within a suite can all have the same setup, e.g. all tests depending on
a full-mesh will be set up with a full-mesh, and is resilient against
changes in test ordering.

Signed-off-by: Lucas Servén Marín <lserven@gmail.com>
2021-06-17 11:48:35 +02:00
Lucas Servén Marín d10b40acb0
e2e: test VPN in e2e tests
This commit adds testing of the VPN feature of Kilo to the e2e tests.
Also, in order to make the tests less flaky, this commit ensures that
the Kilo Pods use the "root" kubeconfig to connect to the API rather
than the Kubernetes API's cluster IP, which can become unavailable when
networking is reconfigured.

Signed-off-by: Lucas Servén Marín <lserven@gmail.com>
2021-06-15 20:41:25 +02:00
Lucas Servén Marín 6542c2ee94
Merge pull request #190 from squat/refactor_e2e
e2e: refactor the end to end tests
2021-06-15 16:58:37 +02:00
Lucas Servén Marín 9f088b87ee
e2e: refactor the end to end tests
This commit refactors the e2e tests in the following ways:
* bump the version of `bash_unit` to 1.7.2: the previous version was
from 2018;
* remove the unused `block` function;
* fix the order of `block_unitil_ready_by_name` and `check_ping`: we
should not attempt to interact with pods before they are considered
ready;
* extract the retry logic into a reusable function called `retry`; and
* retry the `check_adjacent` function for robustness.

Signed-off-by: Lucas Servén Marín <lserven@gmail.com>
2021-06-15 13:09:20 +02:00
Lucas Servén Marín e513e6ca59
Merge pull request #187 from squat/support_mac_m1
Makefile: bump golang toolchain for M1 support
2021-06-14 13:42:49 +02:00
Lucas Servén Marín 0ab16e11b8
Makefile: bump golang toolchain for M1 support
This commit bumps the Golang toolchain version used to build Kilo to go
1.16 to support builing kgctl for the arm64 M1 macs.

Signed-off-by: Lucas Servén Marín <lserven@gmail.com>
2021-06-14 13:00:24 +02:00
leonnicolas 36643b77b4
Use apiextension v1
- upgrade from apiextension v1beta1 to v1
 - generate yaml manifest for crd intead of applying it at runtime
  - users will have to apply the manifest with kubectl
 - kg and kgctl log an error if the crd is not present
 - now validation should actually work

Signed-off-by: leonnicolas <leonloechner@gmx.de>
2021-06-14 12:59:33 +02:00
Lucas Servén Marín a8f4143f53
Merge pull request #147 from JulienVdG/private-registry
Makefile: handle a private registry
2021-05-27 15:40:28 +02:00
leonnicolas 1ab8523d8a
Makefile: workaround to fix broken markdown link in website
Signed-off-by: leonnicolas <leonloechner@gmx.de>
2021-05-21 14:23:10 +02:00
leonnicolas d806fb9126
Makefile, e2e/*: Add end to end tests
Tests are using kind, adjacency and bash_unit.

A kind cluster is spun up and the previously build container image of
Kilo is loaded into it.
Adjacency and a curl container is started.

From the curl container a http request is send to the adjacency service.

The test fails if curl returns an unexpected result.

Two test are run. One with `mesh-granularity=full` and `location`.

The e2e test is only run for pull request because it is a bit flaky for
automatic nightly runs.

Signed-off-by: leonnicolas <leonloechner@gmx.de>
2021-05-20 17:34:17 +02:00
Lucas Servén Marín 845df22a32
docs,README.md: clean up documentation
This commit cleans up some typos in the documentation, clarifies some
explanations, fixes a bash script that would not expand a variable, and
renames the API documentation generator command from gen-docs to
docs-gen to match the output binary name.

Signed-off-by: Lucas Servén Marín <lserven@gmail.com>
2021-05-20 12:45:02 +02:00
leonnicolas 51f1ae94ef
cmd/gen-docs/main.go: auto generate docs for CRD
The new make command `make gen-docs` is introduced.
It will build a markdown file from the CRD introduced by Kilo.

The generation of the docs is a requirement for building the website.

Signed-off-by: leonnicolas <leonloechner@gmx.de>
2021-05-17 13:54:56 +02:00
Julien Viard de Galbert e51a8c92cf Drop intermediate REGISTRY_PREFIX variable and use FULLY_QUALIFIED_IMAGE more consistently
TODO: test this on docker hub
2021-05-11 16:17:25 +02:00
Julien Viard de Galbert 6301503095 Makefile: handle a private registry 2021-05-11 15:53:30 +02:00
Lucas Servén Marín e232af1073
docs: note how to install precompiled kgctl
This commit updates the instructions for installing Kilo. It also fixes
the title-casing of a section on the README and makes a visual change to
the userspace doc to try to make the note clearer.

Signed-off-by: Lucas Servén Marín <lserven@gmail.com>
2021-05-11 14:23:56 +02:00
leonnicolas 2164e7003f
.github/workflows/ci.yml: publish binaries
All kgctl will be published on each new release.
The naming convention is kgctl-<os name>-<architecure>
2021-02-14 19:33:24 +01:00
Lucas Servén Marín c4c8fe81cc
.github/workflows: migrate to github actions
Signed-off-by: Lucas Servén Marín <lserven@gmail.com>
2021-01-31 15:09:11 +01:00
Lucas Servén Marín 42c895f70a
Makefile: no darwin+arm windows+arm build matrix
This commit excludes Darwin+ARM and Windows+ARM combinations from the
build matrix.

Signed-off-by: Lucas Servén Marín <lserven@gmail.com>
2020-11-23 11:16:35 +01:00
Lucas Servén Marín f52efc212c
Makefile: variable detection for cross-compilation
The PR to add support for cross-compilation to other OSs introduced a
bug in ARCH and OS variable detection. This commit fixes it.

Signed-off-by: Lucas Servén Marín <lserven@gmail.com>
2020-11-23 10:18:08 +01:00
Lucas Servén Marín 45cedbb84a
pkg/*: allow kgctl to compile for other OSes
This commit enables the compilation of kgctl when GOOS!=linux.
This fixes #56.

Signed-off-by: Lucas Servén Marín <lserven@gmail.com>
2020-11-14 12:16:07 +01:00
Lucas Servén Marín 0cc1a2ff8c
docs,website: add doc for kg
This commit adds a doc for `kg`, the Kilo agent that runs on every node
in the mesh. This includes: the doc itself, files needed for the
website, and tooling to generate the document using `embedmd`.

Signed-off-by: Lucas Servén Marín <lserven@gmail.com>
2020-09-23 11:38:25 +02:00
Lucas Servén Marín ddab6930d8
Dockerfile: change Alpine pkg CDN
The current Alpine package CDN is timing out for aarch64. This commit
updates it to another mirror. This commit also changes the channel
Alpine channel from edge to v3.12. Note: the Dockerfile overrides the
Alpine CDN settings to ensure that a mirror with support for TLS is
used.

Signed-off-by: Lucas Servén Marín <lserven@gmail.com>
2020-06-03 20:09:50 +02:00
Lucas Servén Marín 77d0863ccc
vendor: bump to go 1.14
Signed-off-by: Lucas Servén Marín <lserven@gmail.com>
2020-05-05 15:17:56 +02:00
Lucas Servén Marín 22a7925e3c
website: fix typo and links
Signed-off-by: Lucas Servén Marín <lserven@gmail.com>
2020-03-10 11:43:48 +01:00
Lucas Servén Marín 72f5107979
docs: remove frontmatter
Signed-off-by: Lucas Servén Marín <lserven@gmail.com>
2020-03-10 00:47:25 +01:00
Lucas Servén Marín 3d9c5f322d
website: create website
This commit introduces a the Kilo website. It is generated with
Docusaurus and can be deployed with standard services like Netlify.

Signed-off-by: Lucas Servén Marín <lserven@gmail.com>
2020-03-09 23:53:30 +01:00
Lucas Servén Marín eb0500f994
Makefile: ensure repo is clean before testing 2020-01-08 18:05:27 +01:00
Lucas Servén Marín 4b2f6c6692
Makefile: use official alpine images for build
This commit modifies the build tooling so that we use the official
alipne build images rather than the images from the multiarch org. This
requires new logic to parse docker manifests but results in a cleaner
solution with fewer architecture definitions.

Signed-off-by: Lucas Servén Marín <lserven@gmail.com>
2020-01-08 17:38:47 +01:00
Lucas Servén Marín 0cbb316ec3
Makefile: bump alpine version 2020-01-07 15:08:05 +01:00
Lucas Servén Marín 4acdca89e5
Makefile: allow headers to have old years 2020-01-07 15:07:34 +01:00
Lucas Servén Marín c9c2e9bc42
*: bump golang to 1.13.4
Signed-off-by: Lucas Servén Marín <lserven@gmail.com>
2019-11-15 15:02:38 +01:00
Lucas Servén Marín f135a16427
Makefile: bump to alpine 3.10
Signed-off-by: Lucas Servén Marín <lserven@gmail.com>
2019-11-15 15:00:36 +01:00
Lucas Servén Marín 887806c7ce
Makefile: fix latest manifest 2019-09-20 00:56:25 +02:00
Lucas Servén Marín f04944df4a
Makefile: fix arm image 2019-09-19 21:48:47 +02:00
Lucas Servén Marín 7c90a40c5a
Makefile: fix arm64 image 2019-09-08 12:02:34 +02:00
Lucas Servén Marín c9969f5be9
Makefile: improve tooling
This commit improves the tooling for the repo and makes all go binaries
managed with go mod. This ensures all tooling is vendored.
2019-05-17 00:23:56 +02:00