Commit Graph

45 Commits

Author SHA1 Message Date
Artem Chernyshev
e7e99cf1b3 feat: support disk usage command in talosctl
Usage example:

```bash
talosctl du --nodes 10.5.0.2 /var -H -d 2
NODE       NAME
10.5.0.2   8.4 kB   etc
10.5.0.2   1.3 GB   lib
10.5.0.2   16 MB    log
10.5.0.2   25 kB    run
10.5.0.2   4.1 kB   tmp
10.5.0.2   1.3 GB   .
```

Supported flags:
- `-a` writes counts for all files, not just directories.
- `-d` recursion depth
- '-H' humanize size outputs.
- '-t' size threshold (skip files if < size or > size).

Fixes: https://github.com/talos-systems/talos/issues/2504

Signed-off-by: Artem Chernyshev <artem.0xD2@gmail.com>
2020-10-13 09:30:31 -07:00
Andrey Smirnov
90d0efec48 feat: pull kubeconfig from the cluster on successful cluster create
Kubeconfig is merged into `~/.kube/config` with rename option
(existing configuration is never overwritten).

If endpoint was used, it is automatically put into the `kubeconfig`.

This should make OS X experience literally `talosctl cluster create`
followed by any `kubectl get ...`.

Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-10-06 05:45:28 -07:00
Andrey Smirnov
16eb47a1a3 feat: use kubeconfig merge in talosctl kubeconfig by default
Kubeconfig merge was completely rewritten to be "smarter":

* automatically apply renames done at previous stages to avoid asking
over and over again (in general should ask just once)

* skip checks if parts of the config match exactly

* allow overwrite as an option

* flexible way to control the output

* activating context in the end

* custom merged context name

Fixes #2578

Fixes #2587

Fixes #2577

Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-10-03 05:36:15 -07:00
Andrey Smirnov
26aaf6af2c feat: support --registry-insecure-skip-verify for cluster create
Also fixes loading for CA certificate for the registry TLS auth.

Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-10-02 11:07:39 -07:00
Andrey Smirnov
b9bfe00b88 feat: support custom filename for talosctl kubeconfig
This also refactors much of the CLI code for the `talosctl kubeconfig`:

1. Do all the checks before fetching kubeconfig from the server: as
kubeconfig generation takes a few seconds, it doesn't make sense to
generate it if it's not going to be used.

2. Unify most of merge & write directly features.

3. Don't use ExtractTarGz method to be more flexible.

4. Allow custom paths for kubeconfig, whether it is a directory or full
path to the file to be created.

Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-09-30 12:05:50 -07:00
Seán C McCord
ff92d2a14b feat: add ApplyConfiguration API
Adds the ability to apply (replace) an existing node configuration with
a new one via the Machine API.

Fixes #2345

Signed-off-by: Seán C McCord <ulexus@gmail.com>
2020-09-29 14:44:06 -07:00
Andrey Smirnov
ff0d4b305a feat: build Talos images/artifacts for amd64/arm64
By default, build outside of Drone works the same and builds only amd64
version, loads images back into dockerd, etc.

If multiple platforms are used, multi-arch images are built which can't
be exported to docker or to `.tar` image, they're always pushed to the
registry (even for PR builds to our internal CI registry).

Artifacts as files (initramfs, kernel) now have `-arch` suffix:
`vmlinuz-amd64`, `initramfs-amd64.xz`. "Magic" script normalizes output
paths depending on whether single platform or multiple platforms were
given.

VM provisioners accept magic `${ARCH}` in initramfs/kernel paths which
gets replaced by cluster architecture.

Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-09-27 10:32:07 -07:00
Andrey Smirnov
b9ce630842 feat: bump default resource limits for talosctl cluster create
Our defaults were too low today, and for Docker they're purely limits,
not pre-allocations. For QEMU we need more memory by default, and QEMU
doesn't support fractional CPU resource anyways.

Disk is a sparse file, so it's not allocated unless being used.

Fixes #2561

Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-09-24 13:36:40 -07:00
Andrew Rynhard
7d2741fc4b chore: migrate to ghcr.io
Move to GHCR.

Signed-off-by: Andrew Rynhard <andrew@rynhard.io>
2020-09-23 15:06:30 -07:00
Andrew Rynhard
c693e556d2 feat: add images command
This adds a command that lists all of the images used by Talos. This is
useful in the case of airgap installs, so that users will know which images
to pull.

Signed-off-by: Andrew Rynhard <andrew@rynhard.io>
2020-09-18 12:55:08 -07:00
Andrey Smirnov
15181aeade feat: use architecture-specific image for core k8s components
This is one step towards running Talos on non-amd64 architectures (e.g. arm64).

Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-09-16 01:11:40 -07:00
Andrey Smirnov
b4341d8780 feat: upgrade kubernetes to 1.19.1
Release notes: https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG/CHANGELOG-1.19.md#v1191

Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-09-11 06:58:12 -07:00
Andrey Smirnov
117c5c3075 feat: implement command talosctl upgrade-k8s
This command handles upgrading Kubernetes control plane from 1.18.x and
1.19.x to 1.19.x.

There's automatic handling of pod-checkpointer to speed up
kube-apiserver upgrades.

Separate PR will add K8s upgrade to integration tests.

Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-09-10 14:08:49 -07:00
Andrey Smirnov
788cd15c29 test: add e2e test to the provision (upgrade) tests
Add sonobuoy runner code with log fetching on failure. Use hand-picked
set of e2e tests to run: verify basic pod functionality, verify service
connectivity.

Add option `--run-e2e` to the `talosctl health` to run quick e2e test to
verify cluster health.

Add option to run provision tests with custom CNI, run one track of
provision tests with Cilium.

Bump Cilium to 1.8.2.

Talos 0.6 won't uncordon node automatically after upgrade from 0.5, as
0.5 doesn't put annotation. Workaround that in upgrade tests.

Bump upgrade test version to 0.6.0 release.

Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-09-08 13:26:31 -07:00
Andrey Smirnov
59adf7315d feat: provide option to run Talos under UEFI in QEMU
This also adds integration pipeline tests for UEFI.

Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-08-28 12:51:10 -07:00
Spencer Smith
4238d4428b feat: update kubernetes to v1.19.0
This PR version bumps all of the kubnernetes version defaults to the
v1.19.0 release.

Signed-off-by: Spencer Smith <robertspencersmith@gmail.com>
2020-08-26 15:30:36 -07:00
Andrey Smirnov
9531635b6c feat: make boostrap via API default choice in talosctl cluster create
As we're going to make API bootstrapping a preferred method of
bootstrapping Talos clusters, our defaults should reflect that.

Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-08-19 13:38:32 -07:00
Spencer Smith
4bb4ea8998 feat: add persist flag to gen config
This PR adds a flag to tweak the persistence value for talosctl gen
config.

Signed-off-by: Spencer Smith <robertspencersmith@gmail.com>
2020-08-06 09:19:58 -07:00
Andrey Smirnov
50c2eabe3d chore: add aliases to some talosctl commands
Aliases are close to regular UNIX commands.

Fixes #2195

Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-07-30 14:58:59 -07:00
Andrey Smirnov
a5d64d97c1 test: update qemu/firecracker provisioners
Fixes #2363 #2364 #2370 #2371

Several changes packed together:

* use compressed `vmlinuz` everywhere, firecracker provisioner
uncompresses it before first use, drop `vmlinux`

* handle reboots in qemu launcher to support reset API case, update
empty disk check to handle reset behavior (erasing partition table)

* make bootloader support default in provisioners, and flag to disable
that

* early support for target architecture for qemu provisioner

This should allow us to use `qemu` in CI/CD (not included into this PR):
integration test passes with qemu.

Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-07-30 21:17:25 +03:00
Andrew Rynhard
1b491d0a66 feat: upgrade Kubernetes to v1.19.0-rc.3
This brings in the latest version of Kubernetes.

Signed-off-by: Andrew Rynhard <andrew@rynhard.io>
2020-07-29 11:04:50 -07:00
Artem Chernyshev
c6eb18eed5 feat: qemu provisioner
Starts and stops qemu VMs, has some initial configuration subset.
Sets up networking through CNI tools, sets up DHCP server which gives IP
addresses to nodes.

Signed-off-by: Artem Chernyshev <artem.0xD2@gmail.com>
2020-07-28 14:55:35 -07:00
Andrey Smirnov
c85608b8d9 test: add an option to bind docker to specific host IP
This allows to override default `0.0.0.0` (`*`) to a specific IP to
avoid conflicts.

Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-07-27 21:13:28 +03:00
Andrey Smirnov
ad99cb6421 feat: implement talosctl dashboard command
This builds a simple CLI UI for Talos cluster monitoring.

Some new APIs were added for monitoring based on Prometheus procfs
package.

Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-07-16 14:24:04 -07:00
Andrey Smirnov
c54639e541 feat: implement server-side API for cluster health checks
This implements existing server-side health checks as defined in
`internal/pkg/cluster/checks` in Talos API.

Summary of changes:

* new `cluster` API

* `apid` now listens without auth on local file socket

* `cluster` API is for now implemented in `machined`, but we can move it
to the new service if we find it more appropriate

* `talosctl health` by default now does server-side health check

UX: `talosctl health` without arguments does health check for the
cluster if it has healthy K8s to return master/worker nodes. If needed,
node list can be overridden with flags.

Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-07-15 13:52:13 -07:00
Andrew Rynhard
0617a10027 feat: upgrade Kubernetes to v1.19.0-rc.0
This brings in the latest version of Kubernetes.

Signed-off-by: Andrew Rynhard <andrew@rynhard.io>
2020-07-14 13:07:18 -07:00
Artem Chernyshev
8fc352ec4f feat: merge mode in talosctl kubeconfig
New flag `-m` will enable merge mechanism in `talosctl kubeconfig`

Command examples:

```
talosctl kubeconfig -m

talosctl kubeconfig -m ~/.kube/config
```

Signed-off-by: Artem Chernyshev <artem.0xD2@gmail.com>
2020-07-10 12:39:30 -07:00
Andrey Smirnov
9590030a84 feat: print crash dump in talosctl cluster create on failure
When cluster fails to be bootstrapped or it fails the health check, it's
hard to find the root cause without the logs.

This change adds optional crashdump (it dumps firecracker logs or docker
logs) after provisioning failure. It's not enabled by default.

Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-07-10 11:54:07 -07:00
Andrey Smirnov
4cc074cdba feat: implement API access to event history
1. Add [xid-based](https://github.com/rs/xid) event IDs. Xids
are sortable and unique enough. Xids also encode event publishing
time with a second precision.

2. Add three ways to look back into event history: based on number of
events, on time and ID. Lookup via ID might be used to restart event
polling in case of broken API connection from the same moment.

3. Reimplement core event buffer with positions which are always
incremented instead of generation+index, this implementation is much
more simple (idea from circular buffer).

4. By default, Events API works the same - it shows no history and
starts streaming new events only.

Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-07-08 10:54:50 -07:00
Andrey Smirnov
0cd86f17c3 fix: provide default DNS domain to talosctl cluster create
Fixes #2263

Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-07-02 13:42:45 -07:00
Andrey Smirnov
3ae5e0e749 test: add short integration test with custom CNI
This adds new flug to `cluster create` to launch cluster with custom
CNI, `integration` pipeline gets a new step to run short test with
Cilium 1.8.0 CNI.

Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-07-01 11:19:19 -07:00
Andrew Rynhard
c21b15f3cf feat: add rollback command
This adds the `rollback` command to `talosctl`.

Signed-off-by: Andrew Rynhard <andrew@andrewrynhard.com>
2020-06-16 20:06:15 -07:00
Spencer Smith
90115bb3ef feat: update kubernetes to 1.19.0-beta.1
This PR brings in all changes necessary to deploy kubernetes 1.19.x.

It relies on an update to our bootkube-plugin project, as well as
implementation of some Image() functions for our various control plane
components, since they are all distinct images and not just hyperkube.

Signed-off-by: Spencer Smith <robertspencersmith@gmail.com>
2020-06-10 15:01:11 -04:00
Spencer Smith
e03a68f8eb feat: update k8s and sonobuoy versions
This PR will update k8s to the latest 1.18 release and bump sonobuoy to
help resolve some e2e flakes. Also adds some retry logic around the
sonobuoy run.

Signed-off-by: Spencer Smith <robertspencersmith@gmail.com>
2020-06-10 06:47:36 -07:00
Spencer Smith
c63c7f15e2 fix: respect nameservers when using docker cluster
This PR will fix some unexpected user behavior where nameservers were
always getting written to 8.8.8.8,1.1.1.1 for the docker-based talos
clusters. This occurred even when updating the docker daemon's config.
This PR will make the docker provisioner respect the --nameserver flag
and allow that to be used to override the defaults.

Signed-off-by: Spencer Smith <robertspencersmith@gmail.com>
2020-05-15 13:58:30 -07:00
Andrew Rynhard
1902519727 feat: add events API
This adds an event stream to the runtime, and the ability to stream
events via the API.

Signed-off-by: Andrew Rynhard <andrew@andrewrynhard.com>
2020-05-13 12:18:10 -07:00
Andrew Rynhard
8e07b1bab3 feat: add bootstrap API
This adds the ability to bootstrap a cluster using the API.
The API simply starts the bootkube service.

Signed-off-by: Andrew Rynhard <andrew@andrewrynhard.com>
2020-05-07 16:47:28 -07:00
Andrew Rynhard
56d7bf19fe feat: add recovery API
This adds an API for recovering the self-hosted control plane.

Signed-off-by: Andrew Rynhard <andrew@andrewrynhard.com>
2020-05-04 19:38:30 -07:00
Andrey Smirnov
55dcbbc8d0 feat: add commands talosctl health/crashdump
This extracts health & crashdump features which were specific to
provisioning code into separate package which can be used standalone.

Everything else is just new glue.

Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-04-27 20:43:10 -07:00
Andrew Rynhard
0051a43aee docs: improve CLI menu and metal docs
This addresses a few common points of confusion for new users.

Signed-off-by: Andrew Rynhard <andrew@andrewrynhard.com>
2020-04-21 10:28:00 -07:00
Spencer Smith
b84d5e2660 feat: allow for exposing ports on docker clusters
This PR will introduce a `-p/--exposed-ports` flag to talosctl. This
flag will allow us to enable port forwards on worker nodes only. This
will allow for ingresses on docker clusters so we can hopefully use
ingress for Arges initial bootstrapping. I modeled this after how KIND allows ingresses
[here](https://kind.sigs.k8s.io/docs/user/ingress/)

Signed-off-by: Spencer Smith <robertspencersmith@gmail.com>
2020-03-30 15:24:25 -04:00
Spencer Smith
3a4eaeeef0 feat: upgrade kubernetes to 1.18
This PR will pull in the latest release of k8s 1.18 so we can start
validating it through our test suite.

Signed-off-by: Spencer Smith <robertspencersmith@gmail.com>
2020-03-26 14:59:43 -04:00
Andrey Smirnov
104af4380e feat: make --wait default option to talosctl cluster create
It seems to be useful enough to be the default one and it prevents
simple mistakes while trying to access the cluster which is not ready
yet.

Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-03-25 06:36:43 -07:00
Spencer Smith
3485ea9f09 fix: update k8s to 1.17.3
This PR will update k8s to v1.17.3 to address CVEs mentioned in https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!topic/kubernetes-security-announce/2UOlsba2g0s

Signed-off-by: Spencer Smith <robertspencersmith@gmail.com>
2020-03-23 17:08:52 -07:00
Andrew Rynhard
5dbc26c7a3 feat: rename osctl to talosctl
This is a rename of the osctl binary. We decided that talosctl is a
better name for the Talos CLI. This does not break any APIs, but does
make older documentation only accurate for previous versions of Talos.

Signed-off-by: Andrew Rynhard <andrew@andrewrynhard.com>
2020-03-20 19:07:39 -07:00