Commit Graph

18 Commits

Author SHA1 Message Date
Artem Chernyshev
ed946b30a6
feat: display OMNI_ENDPOINT in the service account creation UI
Fixes: https://github.com/siderolabs/omni/issues/858

Signed-off-by: Artem Chernyshev <artem.chernyshev@talos-systems.com>
2025-01-29 15:27:36 +03:00
Utku Ozdemir
033e051994
chore: bump Go to 1.23.3, rekres, regenerate sources, make linters happy
Some checks failed
default / default (push) Has been cancelled
default / e2e-backups (push) Has been cancelled
default / e2e-forced-removal (push) Has been cancelled
default / e2e-scaling (push) Has been cancelled
default / e2e-short (push) Has been cancelled
default / e2e-short-secureboot (push) Has been cancelled
default / e2e-templates (push) Has been cancelled
default / e2e-upgrades (push) Has been cancelled
default / e2e-workload-proxy (push) Has been cancelled
Bump Go, rekres (using a build with this fix: https://github.com/siderolabs/kres/pull/464), regenerate sources, comply with the new golangci-lint linters.

Signed-off-by: Utku Ozdemir <utku.ozdemir@siderolabs.com>
2024-11-22 09:47:37 +01:00
Dmitriy Matrenichev
23a4092af5
chore: refactor code
- Redo `backend.Server.Run` so it's easier to reason about.
- Upgrade `math/rand` to `math/rand/v2`
- Remove `resettable` package.
- Add `xcontext` package.

Signed-off-by: Dmitriy Matrenichev <dmitry.matrenichev@siderolabs.com>
2024-10-08 14:01:38 +03:00
Utku Ozdemir
e3d46f949c
feat: implement compression of config fields on resources
Add compression support.

Signed-off-by: Utku Ozdemir <utku.ozdemir@siderolabs.com>
2024-09-11 14:48:57 +02:00
Dmitriy Matrenichev
bfe036e136
chore: allow to specify start and end time for audit-log
This commit allows us to specify the `start` and `end` time for the `audit-log` command. If not specified,
Omni will use current time minus thirty days to get audit logs.

Example:

```bash
omnictl audit-log 2024-08-26 2024-08-27
{"event_type":"create","resource_type":"PublicKeys.omni.sidero.dev","event_ts":1724767441119,"event_data":{"session":{"user_agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36","ip_address":"188.186.141.156","user_id":"3b470fcd-4170-420e-94f8-0ea03180ec35","role":"Admin","email":"dmitry.matrenichev@siderolabs.com","fingerprint":"b07755c2aaf099923182014e05634d017649a42d","public_key_expiration":1724795641}}}
{"event_type":"update","resource_type":"PublicKeys.omni.sidero.dev","event_ts":1724767441762,"event_data":{"session":{"user_agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36","ip_address":"188.186.141.156","user_id":"3b470fcd-4170-420e-94f8-0ea03180ec35","role":"Admin","email":"dmitry.matrenichev@siderolabs.com","fingerprint":"b07755c2aaf099923182014e05634d017649a42d","confirmation_type":"auth0","public_key_expiration":1724795641}}}
{"event_type":"destroy","resource_type":"PublicKeys.omni.sidero.dev","event_ts":1724796226583,"event_data":{"session":{"user_agent":"Omni-Internal-Agent","fingerprint":"b07755c2aaf099923182014e05634d017649a42d"}}}
```

The command passes time directly to the server to avoid any timezone issues.

Signed-off-by: Dmitriy Matrenichev <dmitry.matrenichev@siderolabs.com>
2024-08-28 22:41:05 +03:00
Dmitriy Matrenichev
bf188e4ac1
chore: implement audit log reader
Implement audit log reader functionality and `audit-log` command in `omnictl`.

Closes #578

Signed-off-by: Dmitriy Matrenichev <dmitry.matrenichev@siderolabs.com>
2024-08-23 00:48:17 +03:00
Dmitriy Matrenichev
5d48547c7f
chore: use range-over-func iterators for resource iteration
Bump to Go 1.23 and use new iterator mechanism. Also fix new linter issues.

Signed-off-by: Dmitriy Matrenichev <dmitry.matrenichev@siderolabs.com>
2024-08-22 01:20:55 +03:00
Dmitriy Matrenichev
dc349c1778
chore: do a full generate with latest deps
Update proto generated code.

Signed-off-by: Dmitriy Matrenichev <dmitry.matrenichev@siderolabs.com>
2024-08-21 23:46:39 +03:00
Utku Ozdemir
4ec7a434ba
feat: add cloud provider resources and role
Add the new resources for the cloud provider feature: `CloudConfigs`, `MachineRequests` and `MachineRequestStatuses`.

Add a new role, `CloudProvider` with access to the resources a cloud provider plugin requires.

Introduce the concept of "cloud provider service accounts" which are a special type of service accounts in the format `cloud-provider:<id>`. They must have the `CloudProvider` role and their id is matched against the label `omni.sidero.dev/cloud-provider-id` label on the `MachineRequest*` type resources.

Signed-off-by: Utku Ozdemir <utku.ozdemir@siderolabs.com>
2024-07-28 22:46:43 +02:00
Dmitriy Matrenichev
4cfc0e6dd0
chore: rework auth.* keys, add ctxstore package
Using so-called phantom types we can use the types themselves as keys directly without loosing performance.
You no longer need to remember which type was attached to the thing you passed in context and can look up
all fields access directly.

Part of #37

Signed-off-by: Dmitriy Matrenichev <dmitry.matrenichev@siderolabs.com>
2024-07-15 16:48:04 +03:00
Artem Chernyshev
9671551cb6
fix: use proper permissions for cluster taint resource
This should fix `omnictl kubeconfig/talosconfig --break-glass` command.

Signed-off-by: Artem Chernyshev <artem.chernyshev@talos-systems.com>
2024-07-02 19:17:50 +03:00
Dmitriy Matrenichev
271bb70b12
chore: migrate to oidc v3
Update to latest oidc implementation.

Signed-off-by: Dmitriy Matrenichev <dmitry.matrenichev@siderolabs.com>
2024-06-20 22:55:54 +03:00
Utku Ozdemir
6dcfd4c979
feat: handle all goroutine panics gracefully
Convert goroutine panics to errors or error logs.

Disallow usage of `golang.org/x/sync/errgroup` package in the backend by `depguard` linter. This linter configuration depends on: https://github.com/siderolabs/kres/pull/417

Rekres the project to include the feature (also bump Go to 1.22.4), but revert `PROTOBUF_GO_VERSION` and `GRPC_GATEWAY_VERSION` manually to not break the frontend.

Disallowing the named `go` statement was not possible at the moment using existing linters, raised an issue in `forbidigo` for it: https://github.com/ashanbrown/forbidigo/issues/47

Closes siderolabs/omni#373.

Signed-off-by: Utku Ozdemir <utku.ozdemir@siderolabs.com>
2024-06-20 21:28:12 +02:00
Artem Chernyshev
63ad5bd1ef
feat: provide a way to getadmin talosconfig and kubeconfig
Fixes: https://github.com/siderolabs/omni/issues/33

It is now possible to get full access `kubeconfig` and `talosconfig`
(operator role), if the Omni instance has `enable-break-glass-configs`
flag enabled.

They can be downloaded using cli commands:

`omnictl kubeconfig --admin --cluster <name>`
`omnictl talosconfig --admin --cluster <name>`

After you download the config the cluster will be marked with
`omni.sidero.dev/tainted` annotation to keep in mind that this cluster
has weaker security and might need to get secrets rotation in the
future.

Signed-off-by: Artem Chernyshev <artem.chernyshev@talos-systems.com>
2024-06-12 15:49:48 +03:00
Artem Chernyshev
e12cfa8444
feat: support authcode login in kubectl oidc-login
Omni now allows using `--grant-type=authcode-keyboard` option in
`oidc-login`.
That allows to log in without forwarding `:8000` port from the remote
machine. Instead kubelogin will present a link and ask for
the one time code.

Clicking the link will open Omni web page with one time code.

Fixes: https://github.com/siderolabs/omni/issues/111

Signed-off-by: Artem Chernyshev <artem.chernyshev@talos-systems.com>
2024-06-07 16:59:18 +03:00
Utku Ozdemir
176f9d9f57
feat: compute schematic id only from the extensions
When determining the schematic ID of a machine, instead of relying the ID on the schematic ID meta-extension, compute the ID by gathering the extensions on the machine. This way, the extension ID will not contain the META values, labels or the kernel args.

This ID is actually the ID we need, as when we compare the desired schematic with the actual one during a Talos upgrade, we are only interested in the changes in the list of extensions.

This does not cause the kernel args, labels, etc. to disappear, as they are used at installation time and preserved afterward (e.g., during upgrades).

Additionally:
- Remove the list of extensions from the `Schematic` resource, as it relied upon the schematics always being created through Omni. This is not always the case - i.e., when a partial join config is used. Therefore, instead of relying on it, we store the list of extensions by directly reading them from the machine and storing them on the `MachineStatus` resource.
- Skip setting the schematic META section at all if there are no labels set on Download Installation Media screen.

Closes siderolabs/omni#55.

Signed-off-by: Utku Ozdemir <utku.ozdemir@siderolabs.com>
2024-03-22 14:58:19 +03:00
Artem Chernyshev
1e4e303c09
feat: implement omnictl support command
Works the same way as `talosctl support` but also grabs some relevant
Omni resources to help with the diagnostics.

Uses `go-talos-support` common module to collect Talos data.

Signed-off-by: Artem Chernyshev <artem.chernyshev@talos-systems.com>
2024-03-19 14:20:46 +03:00
Andrey Smirnov
dfcbaae7d0
chore: initial commit
Omni is source-available under BUSL.

Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
Co-Authored-By: Artem Chernyshev <artem.chernyshev@talos-systems.com>
Co-Authored-By: Utku Ozdemir <utku.ozdemir@siderolabs.com>
Co-Authored-By: Dmitriy Matrenichev <dmitry.matrenichev@siderolabs.com>
Co-Authored-By: Philipp Sauter <philipp.sauter@siderolabs.com>
Co-Authored-By: Noel Georgi <git@frezbo.dev>
Co-Authored-By: evgeniybryzh <evgeniybryzh@gmail.com>
Co-Authored-By: Tim Jones <tim.jones@siderolabs.com>
Co-Authored-By: Andrew Rynhard <andrew@rynhard.io>
Co-Authored-By: Spencer Smith <spencer.smith@talos-systems.com>
Co-Authored-By: Christian Rolland <christian.rolland@siderolabs.com>
Co-Authored-By: Gerard de Leeuw <gdeleeuw@leeuwit.nl>
Co-Authored-By: Steve Francis <67986293+steverfrancis@users.noreply.github.com>
Co-Authored-By: Volodymyr Mazurets <volodymyrmazureets@gmail.com>
2024-02-29 17:19:57 +04:00