412 Commits

Author SHA1 Message Date
Artem Chernyshev
b520710810
feat: introduce new flag in reset API that makes Talos reset user disks
Fixes: https://github.com/siderolabs/talos/issues/6815

Additionally, make it possible to run reset in maintenance mode: to
enable a way for resetting system disk and remove all traces of Talos
from it.

The new reset flow works in a separate sequence, changed disk probe
lookup to check the boot partition instead of the ephemeral one.

Signed-off-by: Artem Chernyshev <artem.chernyshev@talos-systems.com>
2023-02-28 15:10:41 +03:00
Utku Ozdemir
f55f5df739
feat: move dashboard package & run it in tty2
Move dashboard package into a common location where both Talos and talosctl can use it.

Add support for overriding stdin, stdout, stderr and ctt in process runner.

Create a dashboard service which runs the dashboard on /dev/tty2.

Redirect kernel messages to tty1 and switch to tty2 after starting the dashboard on it.

Related to siderolabs/talos#6841, siderolabs/talos#4791.

Signed-off-by: Utku Ozdemir <utku.ozdemir@siderolabs.com>
2023-02-28 12:00:25 +01:00
Andrey Smirnov
230e46e567
refactor: extract parts of kubernetes libraries
The shared code is going out to the
github.com/siderolabs/go-kubernetes library.

The code will be used in Talos and other projects using same features.

Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
2023-02-22 14:56:49 +04:00
Dmitriy Matrenichev
8711eea962
fix: use passed --context in talosctl config cmd
Use context from command line flags. Also some minor fixes.

Closes #6846

Signed-off-by: Dmitriy Matrenichev <dmitry.matrenichev@siderolabs.com>
2023-02-21 15:00:04 +03:00
Dmitriy Matrenichev
3d55bd80f4
fix: add --force flag to talosctl gen config
Only overwrite existing files if explicitly demanded.

Closes #6847

Signed-off-by: Dmitriy Matrenichev <dmitry.matrenichev@siderolabs.com>
2023-02-20 23:44:00 +03:00
Andrey Smirnov
c449cb736b
fix: talosctl reboot command passing mode in wait mode
The reboot mode was not passed correctly in wait mode.

Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
2023-02-13 16:20:07 +04:00
Steffen Windoffer
0c6c888745
fix: trackable action flag usage text. --no-wait does not exist
--wait gets set to true

Signed-off-by: Steffen Windoffer <steffen@wind0r.de>
Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
2023-02-06 15:26:38 +04:00
Andrey Smirnov
96629d5ba6
feat: implement etcd maintenance commands
This allows to safely recover out of space quota issues, and perform
degragmentation as needed.

`talosctl etcd status` command provides lots of information about the
cluster health.

See docs for more details.

Fixes #4889

Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
2023-01-03 23:25:28 +04:00
Murtaza Udaipurwala
ba8265bc5c
feat: new talosctl config remove to remove context
Adds a new sub-command to talosctl config. It takes in the context to be
deleted as argument and supports glob matching.

A local flag --noconfirm|-y can be passed to bypass the confirmation
prompt.

It also supports dry run by passing the --dry-run flag similar to
apply-config and edit commands.

Example:

    $ talosctl config remove 'ctx-*'
    Remove context ctx-a? (y/N): y
    Remove context ctx-b? (y/N): y

Signed-off-by: Murtaza Udaipurwala <murtaza@murtazau.xyz>
Signed-off-by: Dmitriy Matrenichev <dmitry.matrenichev@siderolabs.com>
2022-12-29 13:39:12 +03:00
Andrey Smirnov
89dbb0ecf0
release(v1.4.0-alpha.0): prepare release
This is the official v1.4.0-alpha.0 release.

Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
2022-12-23 22:32:09 +04:00
Andrey Smirnov
a0c0352ddc
fix: send diagnostic output to stderr consistently
Fixes #6676

There was a mix of stdout/stderr, move more consistently to stderr.

Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
2022-12-23 18:41:56 +04:00
Andrey Smirnov
ff83d9fd7b
fix: improve talosctl completion
This got broken with a sequence of changes related to not unmarshalling
resources when using `get`.

Rewrite the completion to be more straightforward and use easier
methods.

Make shell completion work even when `nodes` are not set.

Fixes #6646

Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
2022-12-19 18:55:24 +04:00
Andrey Smirnov
a9643b4774
fix: use proper key usage for apid client certificate
This command is referenced from PKI recovery documentation.

Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
2022-12-19 14:33:42 +04:00
Andrey Smirnov
f0dddca2a3
docs: expand help for 'talosctl get'
Make it more obvious how to get list of all resources.

Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
2022-12-05 17:42:28 +04:00
Utku Ozdemir
7ab140a94a
feat: add talosctl machineconfig patch command
Add talosctl machineconfig patch command which accepts a machine config as input and a list of patches, applying the patches and writing the result to a file or to stdout.

Link `talosctl machineconfig gen` to `talosctl gen config`, so they work the same way.

Closes siderolabs/talos#6562.

Signed-off-by: Utku Ozdemir <utku.ozdemir@siderolabs.com>
2022-12-02 15:42:48 +01:00
Utku Ozdemir
44e2799b8c
feat: add stdout and single config type support to talosctl gen config
Add support to specify the types of outputs to be generated by talosctl gen config.

Add support for writing a single type of output to stdout instead of a file.

Related to siderolabs/talos#6562.

Signed-off-by: Utku Ozdemir <utku.ozdemir@siderolabs.com>
2022-12-01 16:55:22 +01:00
Andrey Smirnov
2ebe410e93
feat: update COSI to v0.2.0
This brings many fixes, including a new Watch with support for
Bootstapped and Errored event types.

`talosctl` from before this change is still compatible, as there's gRPC
API level backwards compatibility versioning.

New client doesn't yet depend on new event types, so it will work
against Talos 1.2.x.

Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
2022-11-29 21:21:59 +04:00
Alexandre Mclean
a9e9d71b24
fix: parse correctly upgrade cmd force flag
It was using value of a variable boud to another flag.

Signed-off-by: Alexandre Mclean <alexandre.mclean@gmail.com>
Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
2022-11-24 20:07:23 +04:00
Dmitriy Matrenichev
1f1128028a
chore: add flag to force talos cluster folder deletion
This is handy when the node with qemu went down, so you had to manually delete the folder after it restarted.

Signed-off-by: Dmitriy Matrenichev <dmitry.matrenichev@siderolabs.com>
2022-11-17 20:15:50 +03:00
Utku Ozdemir
e1590ba7b9
fix: lifecycle action tracking
Fixes the bugs introduced on 804762c597f3aebdc3521cefc93bbbf0ff4a57eb and simplifies error handling.

Signed-off-by: Utku Ozdemir <utku.ozdemir@siderolabs.com>
2022-11-10 22:00:30 +01:00
Utku Ozdemir
804762c597
feat: add timeout to cli action tracking, track by default & refactor
Add a timeout of 15 minutes to the trackable CLI actions reboot, reset, shutdown and upgrade and refactor the action tracking.
Make waiting for these operations the default behavior (set `--wait` to `true` by default).

Signed-off-by: Utku Ozdemir <utku.ozdemir@siderolabs.com>
2022-11-10 17:10:26 +01:00
Philipp Sauter
4e114ca120
feat: use the etcd member id for etcd operations instead of hostname
We add a controller that provides the etcd member id as a resource
and change the etcd related commands to support member ids next to
hostnames.

Fixes: #6223

Signed-off-by: Philipp Sauter <philipp.sauter@siderolabs.com>
2022-11-10 19:17:56 +04:00
Andrey Smirnov
96aa9638f7
chore: rename talos-systems/talos to siderolabs/talos
There's a cyclic dependency on siderolink library which imports talos
machinery back. We will fix that after we get talos pushed under a new
name.

Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
2022-11-03 16:50:32 +04:00
Andrey Smirnov
30bbf6463a
refactor: use siderolabs/net version with netip.Addr
Replace most of `net.IP` usage in Talos with `netip.Addr`, refactor code
accordingly.

Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
2022-11-02 14:21:03 +04:00
Andrey Smirnov
343c55762e
chore: replace talos-systems Go modules with siderolabs
This the first step towards replacing all import paths to be based on
`siderolabs/` instead of `talos-systems/`.

All updates contain no functional changes, just refactorings to adapt to
the new path structure.

Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
2022-11-01 12:55:40 +04:00
ankitm123
0301bbe936
fix: check if processes is nil to avoid panic
- A check for nodeData.Processes to check if there are nil before accessing nodeData.Processes.Processes
- Unit tests to catch the panic
- make fmt to format proto files

Signed-off-by: ankitm123 <ankitmohapatra123@gmail.com>
Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
2022-11-01 12:07:41 +04:00
Jon Stelly
8b4ae08d1c
fix: etcd snapshot command on Windows
Close file before renaming

Signed-off-by: Jon Stelly <967068+jonstelly@users.noreply.github.com>
Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
2022-10-28 15:17:05 +04:00
Andrey Smirnov
d7edd0e2e6
refactor: use go-circular, go-kubeconfig, and go-tail
Remove Talos versions, use new extracted Go modules.

Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
2022-10-25 20:20:44 +04:00
Tim Jones
e6fba7d3bc
chore: update dependencies
Updates:
* pkgs v1.3.0-alpha.0-33-g8fe5cbc
* tools v1.3.0-alpha.0-20-g3b5f89a
* aws-sdk-go v1.44.120
* docker v20.10.20+incompatible
* fsnotify v1.6.0
* nftables v0.0.0-20221015190445-4f5cd5826fbd
* gen v0.4.0
* grpc-proxy v0.4.0
* spf13/cobra v1.6.0
* u-root v0.10.0
* x/net v0.1.0
* x/sync v0.1.0
* x/sys v0.1.0
* x/term v0.1.0
* x/time v0.1.0
* grpc v1.50.1
* genproto v0.0.0-20221018160656-63c7b68cfc55
* Linux kernel 5.15.74

Signed-off-by: Tim Jones <tim.jones@siderolabs.com>
2022-10-21 15:20:01 +04:00
Dmitriy Matrenichev
93e55b85f2
chore: bump golangci-lint to v1.50.0
I had to do several things:
- contextcheck now supports Go 1.18 generics, but I had to disable it because of this https://github.com/kkHAIKE/contextcheck/issues/9
- dupword produces to many false positives, so it's also disabled
- revive found all packages which didn't have a documentation comment before. And tehre is A LOT of them. I updated some of them, but gave up at some point and just added them to exclude rules for now.
- change lint-vulncheck to use `base` stage as base

Signed-off-by: Dmitriy Matrenichev <dmitry.matrenichev@siderolabs.com>
2022-10-20 18:33:19 +03:00
Andrey Smirnov
d210338e33
fix: skip protobuf full unmarshaling for some talosctl commands
The following commands:

* `talosctl get`
* `talosctl edit mc`, `talosctl patch mc`

Now these commands don't fully unmarshal resources from protobuf
representation, but rather use YAML representation.

This allows `talosctl` version to be out of sync with Talos version.

Still other commands do full unmarshaling (e.g. `talosctl upgrade-k8s`),
so `talosctl` should match Talos to avoid issues.

Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
2022-10-11 13:32:25 +04:00
Andrey Smirnov
06f76bfebb
chore: bump dependencies
Update to some dependencies moved to siderolabs/ path.

Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
2022-10-04 14:47:27 +04:00
Andrey Smirnov
139c62d762
feat: allow upgrades in maintenance mode (only over SideroLink)
This implements a simple way to upgrade Talos node running in
maintenance mode (only if Talos is installed, i.e. if `STATE` and
`EPHEMERAL` partitions are wiped).

Upgrade is only available over SideroLink for security reasons.

Upgrade in maintenance mode doesn't support any options, and it works
without machine configuration, so proxy environment variables are not
available, registry mirrors can't be used, and extensions are not
installed.

Fixes #6224

Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
2022-09-30 21:16:15 +04:00
Philipp Sauter
f17cdee167
feat: jsonpath filter for talosctl get outputs
We add a filter to the `talosctl get` command that allows users to
specify a jsonpath filter. Now they can reduce the information that is
printed to only the parts they are interested in.

Fixes #6109

Signed-off-by: Philipp Sauter <philipp.sauter@siderolabs.com>
2022-09-27 20:47:11 +02:00
Serge Logvinov
c90e20251d
fix: kubeconfig permission
Set kubeconfig permission to `-rw-------`

Signed-off-by: Serge Logvinov <serge.logvinov@sinextra.dev>
Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
2022-09-23 15:00:43 +04:00
Dmitriy Matrenichev
fc48849d00
chore: move maps/slices/ordered to gen module
Use github.com/siderolabs/gen

Signed-off-by: Dmitriy Matrenichev <dmitry.matrenichev@siderolabs.com>
2022-09-21 20:22:43 +03:00
Noel Georgi
357b770cb5
fix: cryptsetup delete slot
Fix cryptsetup delete slot.

Fixes: #6298

Signed-off-by: Noel Georgi <git@frezbo.dev>
2022-09-21 16:37:54 +05:30
Andrey Smirnov
9df8f1ff1a
fix: list COSI APIs for the apid authenticator
As APIs were not listed explicitly, access with `os:reader` was denied
by default, while it should have been checked down in the access filter.

Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
2022-09-08 21:05:36 +04:00
Andrey Smirnov
f62d17125b
chore: update crypto to use new import path siderolabs/crypto
No functional changes in this PR, just updating import paths.

Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
2022-09-07 23:02:50 +04:00
Andrey Smirnov
36c1f1d6e6
fix: flip the client-server version check
It should have been the opposite: it's a problem if the server version
is _older_ than the client verion.

E.g. using talosctl 1.2.0 against Talos 1.1.2 is a problem, not vice
versa.

Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
2022-09-02 19:14:44 +04:00
Utku Ozdemir
0b339a9dc5
feat: track progress of action API calls
Track the progress of the long-running actions `reboot`, `reset`, `upgrade` and `shutdown` on the client side by default, unless `--no-wait=true` is specified.

Use the events API to follow the events using the actor ID of the action and display it using an stderr reporter with a spinner.

Closes siderolabs/talos#5499.

Signed-off-by: Utku Ozdemir <utku.ozdemir@siderolabs.com>
2022-08-29 22:54:40 +02:00
Andrey Smirnov
d7ef346db8
fix: get command in the case 'nodes' are not set in the context
For maintenance mode (`talosctl get --insecure`), there's no 'nodes'
set, so we run the loop for a single "current" node client is connected
to.

Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
2022-08-29 18:48:59 +04:00
Andrey Smirnov
cdd0f08bc5
feat: check client <> server version in some Talos commands
Talos commands which are sensitive to resource API changes:

* `get`
* `edit`, `patch`
* `upgrade-k8s`

Commands with upcoming changes for actorID:

* `reboot`
* `reset`
* `shutdown`
* `upgrade`

Fixes #6101

Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
2022-08-26 18:37:51 +04:00
Dmitriy Matrenichev
29bd632401
chore: remove old build tags syntax
This commit removes lines contains old build tag syntax.

Signed-off-by: Dmitriy Matrenichev <dmitry.matrenichev@siderolabs.com>
2022-08-24 17:27:01 +03:00
Andrey Smirnov
2f2d97b6b5
fix: don't wait for the hostname in maintenance mode
Fixes #6119

With new stable default hostname feature, any default hostname is
disabled until the machine config is available.

Talos enters maintenance mode when the default config source is empty,
so it doesn't have any machine config available at the moment
maintenance service is started.

Hostname might be set via different sources, e.g. kernel args or via
DHCP before the machine config is available, but if all these sources
are not available, hostname won't be set at all.

This stops waiting for the hostname, and skips setting any DNS names in
the maintenance mode certificate SANs if the hostname is not available.

Also adds a regression test via new `--disable-dhcp-hostname` flag to
`talosctl cluster create`.

Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
2022-08-23 17:52:20 +04:00
Philipp Sauter
7d43fc79b1
fix: make 'ca', 'crt' and 'key' flags optional for 'talosctl config add'
As the 'ca', 'crt' and 'key' parameters are now optional for the talos
client, requiring them for the 'talosctl config add' command no longer
makes sense.

Signed-off-by: Philipp Sauter <philipp.sauter@siderolabs.com>
2022-08-17 16:51:10 +02:00
Noel Georgi
61e3eb2eaa
fix: talosctl edit mc loop
Fixes re-opening editor forever when using `talosctl edit mc`.
Also fixes the temp dir getting filled up with temporary files created
for editing machine config.

Fixes: #6098

Signed-off-by: Noel Georgi <git@frezbo.dev>
2022-08-16 05:37:19 +05:30
Philipp Sauter
f37da96ef3
feat: enable talos client to connect to Talos through an auth proxy
Talos client can connect to Talos API via a proxy with basic auth.
Additionally it is now optional to specify a TLS CA,key or crt. Optionally
Developers can build talosctl with WITH_DEBUG=1 to allow insecure
connections when http:// endpoints are specified.

Fixes #5980

Signed-off-by: Philipp Sauter <philipp.sauter@siderolabs.com>
2022-08-15 18:05:26 +02:00
Utku Ozdemir
586e29dfca
feat: add event actor id to client api and events cmd
Add the missing actor id on the event and a way to filter by it to the events cli command.

Related to siderolabs/talos#5499.

Signed-off-by: Utku Ozdemir <utku.ozdemir@siderolabs.com>
2022-08-12 22:01:34 +02:00
Andrey Smirnov
9baca49662
refactor: implement COSI resource API for Talos
Overview: deprecate existing Talos resource API, and introduce new COSI
API.

Consequences:

* COSI API can only go via one-2-one proxy (`client.WithNode`)
* client-side API access is way easier with `state.State` wrappers
* lots of small changes on the client side to use new APIs

Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
2022-08-12 22:31:54 +04:00