24 Commits

Author SHA1 Message Date
Andrey Smirnov
0babc39653 feat: split osctl commands into Talos API and cluster management
This keeps backwards compatibility with `osctl` CLI binary with the
exception of `osctl config generate` which was renamed to `osctl
gen config` to avoid confusion with other `osctl config`
commands which operate on client config, not Talos server config.

Command implementation and helpers were split into subpackages for
cleaner code and more visible boundaries. The resulting binary still
combines commands from both sections into a single binary.

Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-03-20 22:45:04 +03:00
Spencer Smith
2f4ccfda9a fix: respect dns domain from machine config
BREAKING CHANGE: This PR fixes a bug where we were only passing `cluster.local` to the
kubelet configuration. It will also pull in a new version of the
bootkube fork to ensure that custom domains got propogated down to the
API Server certs, as well as the CoreDNS configuration for a cluster.

Existing users should be aware that, if they were previously trying to
use this option in machine configs, that an upgrade will may break
their cluster. It will update a kubelet flag with the new domain, but
CoreDNS and API Server certs will not change since bootkube has already
run. One option may be to change these values manually inside the
Kubernetes cluster. However, it may prove easier to rebuild the cluster
if necessary.

Additionally, this PR also exposes a flag to `osctl config generate`
to allow tweaking this domain value as well.

Signed-off-by: Spencer Smith <robertspencersmith@gmail.com>
2020-03-20 12:28:17 -04:00
Andrew Rynhard
9cf217d2c1 fix: default reboot flag to false
We should default to shutting down when resetting.

Signed-off-by: Andrew Rynhard <andrew@andrewrynhard.com>
2020-02-19 16:14:00 -08:00
Andrew Rynhard
8a3a76f73e fix: add reboot flag to reset command
This exposes the reboot option for thee reset API by adding a `--reboot`
flag to the CLI.

Signed-off-by: Andrew Rynhard <andrew@andrewrynhard.com>
2020-02-19 15:44:10 -08:00
Spencer Smith
8092362098 fix: fix reset command
This PR will fix the reset command to actually wipe the system disk as
expected.

Signed-off-by: Spencer Smith <robertspencersmith@gmail.com>
2020-02-18 16:18:43 -05:00
Andrey Smirnov
e1779ac77c feat: implement registry mirror & config for image pull
When images are pulled by Talos or via CRI plugin, configuration
for each registry is applied. Mirrors allow to redirect pull request to
either local registry or cached registry. Auth & TLS enable
authentication and TLS authentication for non-public registries.

Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-02-14 00:28:59 +03:00
Andrey Smirnov
33332f4c74 chore: support bootloader emulation in firecracker provisioner
Firecracker launches tries to open VM disk image before every boot,
parses partition table, finds boot partition, tries to read it as FAT32
filesystem, extracts uncompressed kernel from `bzImage` (firecracker
doesn't support `bzImage` yet), extracts initramfs and passes it to
firecracker binary.

This flow allows for extended tests, e.g. testing installer, upgrade and
downgrade tests, etc.

Bootloader emulation is disabled by default for now, can be enabled via
`--with-bootloader-emulation` flag to `osctl cluster create`.

Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-02-13 23:21:37 +03:00
Andrey Smirnov
fae5e6915d chore: rework firecracker code around upstream Go SDK + PRs
This removes use of private fork with custom `ip=` kernel argument
handling and switches fully to upstream version of it.

Firecracker Go SDK version is `master` + following PRs:

* https://github.com/firecracker-microvm/firecracker-go-sdk/pull/167
* https://github.com/firecracker-microvm/firecracker-go-sdk/pull/177
* https://github.com/firecracker-microvm/firecracker-go-sdk/pull/178

MTU handling support was implemented as well.

Changes:

* hostname to each node is passed via `talos.hostname=` kernel arg
* IP configuration is generated by SDK from CNI result
* fixed bugs with wrong netmask
* nameservers & MTU is passed via Talos config

Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-01-29 02:35:15 +03:00
Andrey Smirnov
9da687d2a3 test: firecracker provisioner fixes, implement cluster destroy
This implements `osctl cluster destroy` for Firecracker, adds
new utility command `osctl cluser show`.

Firecracker mode now has control process for firecracker VMs, allowing
clean reboots and background operations.

Lots of small fixes to Firecracker mode, clean CNI shutdown, cleaning up
netns, etc.

Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-01-21 17:11:06 -08:00
Spencer Smith
60260c85d1 feat: upgrade kubernetes version to 1.17.1
This PR will bring in the latest point release of k8s 1.17

Signed-off-by: Spencer Smith <robertspencersmith@gmail.com>
2020-01-17 09:39:26 -08:00
Andrew Rynhard
d933ca9a88 docs: add missing docs
The `docs` target needed to be ran.

Signed-off-by: Andrew Rynhard <andrew@andrewrynhard.com>
2020-01-15 19:08:41 -08:00
Spencer Smith
75d9f7b454 feat: support configurable docker-based clusters
This PR will allow users to issue `osctl config generate`, tweak the
configs to their liking, then use those configs to call `osctl cluster
create`.

Example workflow:

```
osctl config generate my-cluster https://10.5.0.2:6443 -o ./my-cluster

** tweaky tweak **

osctl cluster create --name my-cluster --input-dir "$PWD/my-cluster"
```

Signed-off-by: Spencer Smith <robertspencersmith@gmail.com>
2020-01-08 14:11:56 -05:00
Andrey Smirnov
ebd40bd0eb chore: use osctl cluster --wait in basic-integration
There are few workarounds for Drone way of running integration test:
DinD runs as a separate pod, and we can only access its exposed on the
"host" ports, while from Talos cluster this endpoint is not reachable.

So internally Talos nodes still use addresses like "10.5.0.2", while
test is using "docker" to access it (that's name of the `docker` service
in the pipeline).

When running locally, 127.0.0.1 is used as endpoint, which should work
fine both on OS X and Linux.

Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2019-12-30 15:15:42 -08:00
Andrey Smirnov
0081ac5fac refactor: extract Talos cluster provisioner as common code
This extracts Docker Talos cluster provisioner as common code
which might be shared between `osctl cluster` and integration-test.

There should be almost no functional changes.

As proof of concept, abstract cluster readiness checks were implemented
based on provisioned cluster state. It implements same checks as
`basic-integration.sh` in pure Go via Talos/K8s clients.

`conditions` package was promoted from machined-internal to
`internal/pkg` as it is used to run the checks.

Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2019-12-27 12:14:19 -08:00
Andrew Rynhard
5a7eb631b2 feat: add installer command to installer container
This replaces the entrypoint.sh shell script with a go binary.

Signed-off-by: Andrew Rynhard <andrew@andrewrynhard.com>
2019-12-26 06:41:25 -08:00
Andrew Rynhard
e4a1bc3cf9 chore: add help menu to the Makefile
This adds a help  menu to the Makefile. It documents all build
dependencies, and how to get started.

Signed-off-by: Andrew Rynhard <andrew@andrewrynhard.com>
2019-12-25 11:11:41 -08:00
Andrey Smirnov
26f222e6db refactor: osctl code cleanup, no functional changes
Fixes #1666

1. Remove custom validation of Args, use cobra-provided validators.
2. Always use errors to stop the execution flow, don't rely on
`log.Fatal` and `panic` for normal flows. This makes sure `defer` always
has a chance to run, connection is shut down in a clean way.
3. Command `docs` is hidden, as it's not for users.
4. Global variable `globalCtx` is removed, `WithClient` is used to pass
context to the command.
5. `setupClientE` renamed to `WithClient`, `setupClient` removed.
6. Code from `cmd/root.go` moved to `pkg/helpers` when possible.

Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2019-12-20 00:32:26 +03:00
Andrey Smirnov
c24ce2fd5f feat: humanize timestamp and size in osctl list output
Fixes #1565

Examples:

```
$ osctl list -l
MODE          SIZE(B)   LASTMOD           NAME
drwxr-xr-x    4096      Dec 17 16:37:19   .
-rwxr-xr-x    0         Dec 17 16:37:19   .dockerenv
drwxr-xr-x    4096      Dec 17 16:35:20   bin
drwxr-xr-x    4096      Dec 17 16:37:20   boot
drwxr-xr-x    5480      Dec 17 16:37:19   dev
drwxr-xr-x    4096      Dec 17 16:37:19   etc
drwxr-xr-x    4096      Dec 17 16:35:19   lib
drwxr-xr-x    4096      Dec 17 16:35:21   mnt
drwxr-xr-x    4096      Dec 17 16:39:17   opt
dr-xr-xr-x    0         Dec 17 16:37:19   proc
drwxr-x---    4096      Dec  5 06:39:44   root
drwxr-xr-x    4096      Dec 17 16:39:06   run
drwxr-xr-x    4096      Dec 17 16:35:20   sbin
dr-xr-xr-x    0         Dec 17 16:37:19   sys
dtrwxrwxrwx   4096      Dec 17 16:38:05   tmp
drwxr-xr-x    4096      Dec 17 16:35:21   usr
drwxr-xr-x    4096      Dec 17 16:37:19   var
```

```
$ osctl list -lH
MODE          SIZE(B)   LASTMOD          NAME
drwxr-xr-x    4.1 kB    18 minutes ago   .
-rwxr-xr-x    0 B       18 minutes ago   .dockerenv
drwxr-xr-x    4.1 kB    20 minutes ago   bin
drwxr-xr-x    4.1 kB    18 minutes ago   boot
drwxr-xr-x    5.5 kB    18 minutes ago   dev
drwxr-xr-x    4.1 kB    18 minutes ago   etc
drwxr-xr-x    4.1 kB    20 minutes ago   lib
drwxr-xr-x    4.1 kB    20 minutes ago   mnt
drwxr-xr-x    4.1 kB    16 minutes ago   opt
dr-xr-xr-x    0 B       18 minutes ago   proc
drwxr-x---    4.1 kB    1 week ago       root
drwxr-xr-x    4.1 kB    16 minutes ago   run
drwxr-xr-x    4.1 kB    20 minutes ago   sbin
dr-xr-xr-x    0 B       18 minutes ago   sys
dtrwxrwxrwx   4.1 kB    17 minutes ago   tmp
drwxr-xr-x    4.1 kB    20 minutes ago   usr
drwxr-xr-x    4.1 kB    18 minutes ago   var
```

Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2019-12-17 23:21:28 +03:00
Andrey Smirnov
4c18f21088 feat: osctl bash/zsh completion support
Fixes #1500

Most of the help lines borrowed from kubectl. Basic completion seems to
work, but the `osctl` binary should be named `osctl` (not
`osctl-linux-amd64` or such).

Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2019-12-17 16:27:51 +03:00
Andrew Rynhard
ad863a7f92 refactor: rename protobuf services, RPCs, and messages
This PR brings our protobuf files into conformance with the protobuf
style guide, and community conventions. It is purely renames, along with
generated docs.

Signed-off-by: Andrew Rynhard <andrew@andrewrynhard.com>
2019-12-11 11:41:40 -08:00
Brad Beam
9584b47cd7 feat: Upgrade kubernetes to 1.17.0
Primarily doc/constant changes.

Added additionnal bits to `docs` target in makefile to generate osctl
docs as well as config files. Explicitly define a HOME variable so we
get consistent home directories for talosconfig variables in our docs.

Signed-off-by: Brad Beam <brad.beam@talos-systems.com>
2019-12-10 16:03:35 -08:00
Andrey Smirnov
399aeda0b9 feat: rename confusing target options, --endpoints, etc.
Fixes #1610

1. In `talosconfig`, deprecate `Target` in favor of `Endpoints`
(client-side LB to come next).

2. In `osctl`, use `--nodes` in place of `--target`.

3. In `osctl` add option `--endpoints` to override `Endpoints` for the
call.

Other changes are just updates to catch up with the changes. Most
probably I missed something... And CAPI provider needs update.

Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2019-12-10 02:23:54 +03:00
Andrey Smirnov
4f22581464 docs: update generated osctl documentation
`--context`, `osctl logs -f`, `osctl read`

Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2019-12-06 14:13:41 -08:00
Andrew Rynhard
127fa54a76 docs: add docs command to osctl
This allows osctl to generate documentation for itself.

Signed-off-by: Andrew Rynhard <andrew@andrewrynhard.com>
2019-11-13 17:14:53 -08:00