From 230af36fa219c9b402177e27a01dc3fadb3fc9ce Mon Sep 17 00:00:00 2001 From: Miek Gieben Date: Wed, 22 Apr 2026 16:23:41 +0200 Subject: [PATCH 1/9] feat: add uc machine context This gets the context from the remote machine and add it to the correct place in your uncloud config. Signed-off-by: Miek Gieben --- internal/cli/cli.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/cli/cli.go b/internal/cli/cli.go index 0ab60d04..8f55d1be 100644 --- a/internal/cli/cli.go +++ b/internal/cli/cli.go @@ -191,7 +191,7 @@ func (cli *CLI) InitCluster(ctx context.Context, opts InitClusterOptions) (*clie } func (cli *CLI) initRemoteMachine(ctx context.Context, opts InitClusterOptions) (*client.Client, error) { - contextName, err := cli.newContextName(opts.Context) + contextName, err := cli.NewContextName(opts.Context) if err != nil { return nil, err } @@ -289,10 +289,10 @@ func (cli *CLI) initRemoteMachine(ctx context.Context, opts InitClusterOptions) return machineClient, nil } -// newContextName returns a unique name for a new cluster context. If the provided name is not DefaultContextName, +// NewContextName returns a unique name for a new cluster context. If the provided name is not DefaultContextName, // and it's already taken, an error is returned. If the name is not provided or is DefaultContextName, the first // available name "default[-N]" is returned. -func (cli *CLI) newContextName(name string) (string, error) { +func (cli *CLI) NewContextName(name string) (string, error) { if name == "" { name = DefaultContextName } From b9674d5c7e89e1031ac20463038d8487c18e6c46 Mon Sep 17 00:00:00 2001 From: Miek Gieben Date: Wed, 22 Apr 2026 16:24:57 +0200 Subject: [PATCH 2/9] add context.go Signed-off-by: Miek Gieben --- cmd/uc/machine/context.go | 138 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 138 insertions(+) create mode 100644 cmd/uc/machine/context.go diff --git a/cmd/uc/machine/context.go b/cmd/uc/machine/context.go new file mode 100644 index 00000000..4aa8eca3 --- /dev/null +++ b/cmd/uc/machine/context.go @@ -0,0 +1,138 @@ +package machine + +import ( + "context" + "fmt" + "strings" + + "github.com/psviderski/uncloud/internal/cli" + "github.com/psviderski/uncloud/internal/cli/config" + "github.com/spf13/cobra" +) + +type contextOptions struct { + context string + sshKey string +} + +func NewContextCommand() *cobra.Command { + opts := contextOptions{} + cmd := &cobra.Command{ + Use: "context [schema://]USER@HOST[:PORT]", + Short: "Add the cluster context to Uncloud configuration file by connecting to the remote machine.", + Long: `Add the cluster context, or add new machines to an existing cluster context. +This command adds or updates an (existing) context in your Uncloud config. + +Connection methods: + [ssh://]user@host - Use system 'ssh' command with full SSH config support (default, no prefix required) + ssh+go://user@host - Use Go's built-in SSH library`, + Example: ` # Initialise a new cluster with default settings. + uc machine context root@ + + # Add a new context named 'prod' in the Uncloud config (~/.config/uncloud/config.yaml). + uc machine context root@ -c prod + + # A a new context with a non-root user and custom SSH port and key. + uc machine init ubuntu@:2222 -i ~/.ssh/mykey`, + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + uncli := cmd.Context().Value("cli").(*cli.CLI) + + destination := args[0] + useSSHGo := strings.HasPrefix(destination, "ssh+go://") + destination = strings.TrimPrefix(destination, "ssh+go://") + destination = strings.TrimPrefix(destination, "ssh+cli://") + destination = strings.TrimPrefix(destination, "ssh://") + + if _, _, _, err := config.SSHDestination(destination).Parse(); err != nil { + return fmt.Errorf("parse remote machine: %w", err) + } + + conn := config.MachineConnection{} + if useSSHGo { + conn.SSHGo = config.SSHDestination(destination) + } else { + conn.SSH = config.SSHDestination(destination) + } + + return listContext(cmd.Context(), uncli, conn, opts) + }, + } + + cmd.Flags().StringVarP( + &opts.context, "context", "c", cli.DefaultContextName, + "Name of the new context to be created in the Uncloud config to manage the cluster.", + ) + cmd.Flags().StringVarP( + &opts.sshKey, "ssh-key", "i", "", + fmt.Sprintf("Path to SSH private key for remote login (if not already added to SSH agent). (default %q)", + cli.DefaultSSHKeyPath), + ) + // write flag,to save? + + return cmd +} + +func listContext(ctx context.Context, uncli *cli.CLI, conn config.MachineConnection, opts contextOptions) error { + contextName, err := uncli.NewContextName(opts.context) + if err != nil { + return err + } + + conn.SSHKeyFile = opts.sshKey + client, err := cli.ConnectCluster(ctx, conn, cli.ConnectOptions{ShowProgress: true}) + if err != nil { + return fmt.Errorf("connect to cluster: %w", err) + } + defer client.Close() + + machines, err := client.ListMachines(ctx, nil) + if err != nil { + return fmt.Errorf("list machines: %w", err) + } + + // Figure out if one of the machines is already in a context, and add the remaining there. Otherwise we + // create a new context with the optional name we got from the command line. + for name, context := range uncli.Config.Contexts { + for _, conn := range context.Connections { + for _, machine := range machines { + if machine.Machine.Id == conn.MachineID { + contextName = name + break + } + } + } + } + + var ( + user string + port int + ) + + if conn.SSH != "" { + user, _, port, _ = conn.SSH.Parse() + } + if conn.SSHGo != "" { + user, _, port, _ = conn.SSHGo.Parse() + } + + connCfg := []config.MachineConnection{} + for _, machine := range machines { + dest := config.NewSSHDestination(user, machine.Machine.PublicIp.String(), port) + + machineConn := config.MachineConnection{SSHKeyFile: opts.sshKey} + if conn.SSH != "" { + machineConn.SSH = dest + } + if conn.SSHGo != "" { + machineConn.SSHGo = dest + } + connCfg = append(connCfg, machineConn) + } + + uncli.Config.Contexts[contextName].Connections = connCfg + if err = uncli.Config.Save(); err != nil { + return fmt.Errorf("save config: %w", err) + } + return nil +} From 55c98b5c11f5f7f3696fd6c068169d45a4ed3e4f Mon Sep 17 00:00:00 2001 From: Miek Gieben Date: Wed, 22 Apr 2026 16:33:09 +0200 Subject: [PATCH 3/9] Add -w flag Signed-off-by: Miek Gieben --- cmd/uc/machine/context.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/cmd/uc/machine/context.go b/cmd/uc/machine/context.go index 4aa8eca3..86422328 100644 --- a/cmd/uc/machine/context.go +++ b/cmd/uc/machine/context.go @@ -3,8 +3,10 @@ package machine import ( "context" "fmt" + "os" "strings" + "github.com/goccy/go-yaml" "github.com/psviderski/uncloud/internal/cli" "github.com/psviderski/uncloud/internal/cli/config" "github.com/spf13/cobra" @@ -13,6 +15,7 @@ import ( type contextOptions struct { context string sshKey string + write bool } func NewContextCommand() *cobra.Command { @@ -68,7 +71,10 @@ Connection methods: fmt.Sprintf("Path to SSH private key for remote login (if not already added to SSH agent). (default %q)", cli.DefaultSSHKeyPath), ) - // write flag,to save? + cmd.Flags().BoolVarP( + &opts.write, "write", "w", false, + "Write a new Uncloud config, by default the config is only printed to standard output.", + ) return cmd } @@ -130,6 +136,12 @@ func listContext(ctx context.Context, uncli *cli.CLI, conn config.MachineConnect connCfg = append(connCfg, machineConn) } + if !opts.write { + encoder := yaml.NewEncoder(os.Stdout, yaml.Indent(2), yaml.IndentSequence(true)) + encoder.Encode(connCfg) + return nil + } + uncli.Config.Contexts[contextName].Connections = connCfg if err = uncli.Config.Save(); err != nil { return fmt.Errorf("save config: %w", err) From 70cf1ddfa277672263e1c2aec71c4d4ef871459f Mon Sep 17 00:00:00 2001 From: Miek Gieben Date: Wed, 22 Apr 2026 17:50:10 +0200 Subject: [PATCH 4/9] Some fixes Signed-off-by: Miek Gieben --- cmd/uc/machine/context.go | 21 ++++++++++++++------- cmd/uc/machine/root.go | 1 + 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/cmd/uc/machine/context.go b/cmd/uc/machine/context.go index 86422328..3891e4c2 100644 --- a/cmd/uc/machine/context.go +++ b/cmd/uc/machine/context.go @@ -29,14 +29,14 @@ This command adds or updates an (existing) context in your Uncloud config. Connection methods: [ssh://]user@host - Use system 'ssh' command with full SSH config support (default, no prefix required) ssh+go://user@host - Use Go's built-in SSH library`, - Example: ` # Initialise a new cluster with default settings. - uc machine context root@ + Example: ` # Get the cluster context with default settings. + uc machine context -w root@ # Add a new context named 'prod' in the Uncloud config (~/.config/uncloud/config.yaml). - uc machine context root@ -c prod + uc machine context -w root@ -c prod # A a new context with a non-root user and custom SSH port and key. - uc machine init ubuntu@:2222 -i ~/.ssh/mykey`, + uc machine context -w ubuntu@:2222 -i ~/.ssh/mykey`, Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error { uncli := cmd.Context().Value("cli").(*cli.CLI) @@ -124,9 +124,10 @@ func listContext(ctx context.Context, uncli *cli.CLI, conn config.MachineConnect connCfg := []config.MachineConnection{} for _, machine := range machines { - dest := config.NewSSHDestination(user, machine.Machine.PublicIp.String(), port) + addr, _ := machine.Machine.PublicIp.ToAddr() + dest := config.NewSSHDestination(user, addr.String(), port) - machineConn := config.MachineConnection{SSHKeyFile: opts.sshKey} + machineConn := config.MachineConnection{MachineID: machine.Machine.Id} if conn.SSH != "" { machineConn.SSH = dest } @@ -138,7 +139,13 @@ func listContext(ctx context.Context, uncli *cli.CLI, conn config.MachineConnect if !opts.write { encoder := yaml.NewEncoder(os.Stdout, yaml.Indent(2), yaml.IndentSequence(true)) - encoder.Encode(connCfg) + contexts := map[string]*config.Context{ + contextName: { + Connections: connCfg, + }, + } + + encoder.Encode(contexts) return nil } diff --git a/cmd/uc/machine/root.go b/cmd/uc/machine/root.go index 3bb70443..32645b79 100644 --- a/cmd/uc/machine/root.go +++ b/cmd/uc/machine/root.go @@ -19,6 +19,7 @@ func NewRootCommand() *cobra.Command { NewRmCommand(), NewRTTCommand(), NewUpdateCommand(), + NewContextCommand(), ) return cmd } From 0f3348e19afae636fc99a0d94d9bdd44dedbbf09 Mon Sep 17 00:00:00 2001 From: Miek Gieben Date: Wed, 22 Apr 2026 17:56:53 +0200 Subject: [PATCH 5/9] docs Signed-off-by: Miek Gieben --- website/docs/9-cli-reference/uc_machine.md | 1 + 1 file changed, 1 insertion(+) diff --git a/website/docs/9-cli-reference/uc_machine.md b/website/docs/9-cli-reference/uc_machine.md index 42d318ce..5ebef1b6 100644 --- a/website/docs/9-cli-reference/uc_machine.md +++ b/website/docs/9-cli-reference/uc_machine.md @@ -21,6 +21,7 @@ Manage machines in the cluster. * [uc](uc.md) - A CLI tool for managing Uncloud resources such as machines, services, and volumes. * [uc machine add](uc_machine_add.md) - Add a remote machine to a cluster. +* [uc machine context](uc_machine_context.md) - Add the cluster context to Uncloud configuration file by connecting to the remote machine. * [uc machine init](uc_machine_init.md) - Initialise a new cluster with a remote machine as the first member. * [uc machine logs](uc_machine_logs.md) - View system service logs. * [uc machine ls](uc_machine_ls.md) - List machines in a cluster. From ba8140b688e1ac76b93540beb996b0830a2d88fe Mon Sep 17 00:00:00 2001 From: Miek Gieben Date: Thu, 23 Apr 2026 07:14:53 +0200 Subject: [PATCH 6/9] More inline with other commands Add context as alias and make main cmd ctx Signed-off-by: Miek Gieben --- cmd/uc/machine/context.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/cmd/uc/machine/context.go b/cmd/uc/machine/context.go index 3891e4c2..363b44f4 100644 --- a/cmd/uc/machine/context.go +++ b/cmd/uc/machine/context.go @@ -21,8 +21,9 @@ type contextOptions struct { func NewContextCommand() *cobra.Command { opts := contextOptions{} cmd := &cobra.Command{ - Use: "context [schema://]USER@HOST[:PORT]", - Short: "Add the cluster context to Uncloud configuration file by connecting to the remote machine.", + Aliases: []string{"context"}, + Use: "ctx [schema://]USER@HOST[:PORT]", + Short: "Add the cluster context to Uncloud configuration file by connecting to the remote machine.", Long: `Add the cluster context, or add new machines to an existing cluster context. This command adds or updates an (existing) context in your Uncloud config. @@ -30,13 +31,13 @@ Connection methods: [ssh://]user@host - Use system 'ssh' command with full SSH config support (default, no prefix required) ssh+go://user@host - Use Go's built-in SSH library`, Example: ` # Get the cluster context with default settings. - uc machine context -w root@ + uc machine ctx -w root@ # Add a new context named 'prod' in the Uncloud config (~/.config/uncloud/config.yaml). - uc machine context -w root@ -c prod + uc machine ctx -w root@ -c prod - # A a new context with a non-root user and custom SSH port and key. - uc machine context -w ubuntu@:2222 -i ~/.ssh/mykey`, + # Add a new context with a non-root user and custom SSH port and key. + uc machine ctx -w ubuntu@:2222 -i ~/.ssh/mykey`, Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error { uncli := cmd.Context().Value("cli").(*cli.CLI) From 501cadc23436f2c4afea97bec309f8624afcbd39 Mon Sep 17 00:00:00 2001 From: Miek Gieben Date: Thu, 23 Apr 2026 07:30:25 +0200 Subject: [PATCH 7/9] docs Signed-off-by: Miek Gieben --- website/docs/9-cli-reference/uc_machine.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/9-cli-reference/uc_machine.md b/website/docs/9-cli-reference/uc_machine.md index 5ebef1b6..92de276c 100644 --- a/website/docs/9-cli-reference/uc_machine.md +++ b/website/docs/9-cli-reference/uc_machine.md @@ -21,7 +21,7 @@ Manage machines in the cluster. * [uc](uc.md) - A CLI tool for managing Uncloud resources such as machines, services, and volumes. * [uc machine add](uc_machine_add.md) - Add a remote machine to a cluster. -* [uc machine context](uc_machine_context.md) - Add the cluster context to Uncloud configuration file by connecting to the remote machine. +* [uc machine ctx](uc_machine_ctx.md) - Add the cluster context to Uncloud configuration file by connecting to the remote machine. * [uc machine init](uc_machine_init.md) - Initialise a new cluster with a remote machine as the first member. * [uc machine logs](uc_machine_logs.md) - View system service logs. * [uc machine ls](uc_machine_ls.md) - List machines in a cluster. From 5451bc060f9bf0976150dfe3fc3938466d9b386f Mon Sep 17 00:00:00 2001 From: Miek Gieben Date: Tue, 28 Jul 2026 14:27:58 +0200 Subject: [PATCH 8/9] Create uc context create Signed-off-by: Miek Gieben --- .../{machine/context.go => context/create.go} | 35 +++++++------ cmd/uc/context/root.go | 1 + cmd/uc/machine/root.go | 1 - website/docs/9-cli-reference/uc_ctx.md | 1 + website/docs/9-cli-reference/uc_ctx_create.md | 52 +++++++++++++++++++ website/docs/9-cli-reference/uc_machine.md | 1 - 6 files changed, 74 insertions(+), 17 deletions(-) rename cmd/uc/{machine/context.go => context/create.go} (78%) create mode 100644 website/docs/9-cli-reference/uc_ctx_create.md diff --git a/cmd/uc/machine/context.go b/cmd/uc/context/create.go similarity index 78% rename from cmd/uc/machine/context.go rename to cmd/uc/context/create.go index 363b44f4..f3e13862 100644 --- a/cmd/uc/machine/context.go +++ b/cmd/uc/context/create.go @@ -1,43 +1,45 @@ -package machine +package context import ( "context" "fmt" "os" + "slices" "strings" "github.com/goccy/go-yaml" "github.com/psviderski/uncloud/internal/cli" "github.com/psviderski/uncloud/internal/cli/config" + "github.com/psviderski/uncloud/internal/machine/api/pb" "github.com/spf13/cobra" ) -type contextOptions struct { +type createOptions struct { context string sshKey string write bool } -func NewContextCommand() *cobra.Command { - opts := contextOptions{} +func NewCreateCommand() *cobra.Command { + opts := createOptions{} cmd := &cobra.Command{ - Aliases: []string{"context"}, - Use: "ctx [schema://]USER@HOST[:PORT]", - Short: "Add the cluster context to Uncloud configuration file by connecting to the remote machine.", - Long: `Add the cluster context, or add new machines to an existing cluster context. -This command adds or updates an (existing) context in your Uncloud config. + Use: "create [schema://]USER@HOST[:PORT]", + Short: "Create the cluster context to Uncloud configuration file by connecting to the remote machine.", + Long: `Create the cluster context, or add new machines to an existing cluster context. +This command adds or updates an (existing) context in your Uncloud config with machines that have a public IP address +configured. Connection methods: [ssh://]user@host - Use system 'ssh' command with full SSH config support (default, no prefix required) ssh+go://user@host - Use Go's built-in SSH library`, Example: ` # Get the cluster context with default settings. - uc machine ctx -w root@ + uc context create -w root@ # Add a new context named 'prod' in the Uncloud config (~/.config/uncloud/config.yaml). - uc machine ctx -w root@ -c prod + uc context create -w root@ -c prod # Add a new context with a non-root user and custom SSH port and key. - uc machine ctx -w ubuntu@:2222 -i ~/.ssh/mykey`, + uc context create -w ubuntu@:2222 -i ~/.ssh/mykey`, Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error { uncli := cmd.Context().Value("cli").(*cli.CLI) @@ -59,7 +61,7 @@ Connection methods: conn.SSH = config.SSHDestination(destination) } - return listContext(cmd.Context(), uncli, conn, opts) + return createContext(cmd.Context(), uncli, conn, opts) }, } @@ -80,7 +82,7 @@ Connection methods: return cmd } -func listContext(ctx context.Context, uncli *cli.CLI, conn config.MachineConnection, opts contextOptions) error { +func createContext(ctx context.Context, uncli *cli.CLI, conn config.MachineConnection, opts createOptions) error { contextName, err := uncli.NewContextName(opts.context) if err != nil { return err @@ -97,9 +99,12 @@ func listContext(ctx context.Context, uncli *cli.CLI, conn config.MachineConnect if err != nil { return fmt.Errorf("list machines: %w", err) } + machines = slices.DeleteFunc(machines, func(m *pb.MachineMember) bool { + return m.Machine.GetPublicIp() == nil + }) // Figure out if one of the machines is already in a context, and add the remaining there. Otherwise we - // create a new context with the optional name we got from the command line. + // create a new context with the name we got from the command line. for name, context := range uncli.Config.Contexts { for _, conn := range context.Connections { for _, machine := range machines { diff --git a/cmd/uc/context/root.go b/cmd/uc/context/root.go index dda22c2e..0744b004 100644 --- a/cmd/uc/context/root.go +++ b/cmd/uc/context/root.go @@ -21,6 +21,7 @@ func NewRootCommand() *cobra.Command { NewListCommand(), NewUseCommand(), NewConnectionCommand(), + NewCreateCommand(), NewShowCommand(), ) diff --git a/cmd/uc/machine/root.go b/cmd/uc/machine/root.go index 32645b79..3bb70443 100644 --- a/cmd/uc/machine/root.go +++ b/cmd/uc/machine/root.go @@ -19,7 +19,6 @@ func NewRootCommand() *cobra.Command { NewRmCommand(), NewRTTCommand(), NewUpdateCommand(), - NewContextCommand(), ) return cmd } diff --git a/website/docs/9-cli-reference/uc_ctx.md b/website/docs/9-cli-reference/uc_ctx.md index f421543f..b9f2c6a3 100644 --- a/website/docs/9-cli-reference/uc_ctx.md +++ b/website/docs/9-cli-reference/uc_ctx.md @@ -25,6 +25,7 @@ uc ctx [flags] * [uc](uc.md) - A CLI tool for managing Uncloud resources such as machines, services, and volumes. * [uc ctx connection](uc_ctx_connection.md) - Choose a new default connection for the current context. +* [uc ctx create](uc_ctx_create.md) - Create the cluster context to Uncloud configuration file by connecting to the remote machine. * [uc ctx ls](uc_ctx_ls.md) - List available cluster contexts. * [uc ctx show](uc_ctx_show.md) - Show current cluster context. * [uc ctx use](uc_ctx_use.md) - Switch to a different cluster context. diff --git a/website/docs/9-cli-reference/uc_ctx_create.md b/website/docs/9-cli-reference/uc_ctx_create.md new file mode 100644 index 00000000..a0336ba9 --- /dev/null +++ b/website/docs/9-cli-reference/uc_ctx_create.md @@ -0,0 +1,52 @@ +# uc ctx create + +Create the cluster context to Uncloud configuration file by connecting to the remote machine. + +## Synopsis + +Create the cluster context, or add new machines to an existing cluster context. +This command adds or updates an (existing) context in your Uncloud config with machines that have a public IP address +configured. + +Connection methods: + [ssh://]user@host - Use system 'ssh' command with full SSH config support (default, no prefix required) + ssh+go://user@host - Use Go's built-in SSH library + +``` +uc ctx create [schema://]USER@HOST[:PORT] [flags] +``` + +## Examples + +``` + # Get the cluster context with default settings. + uc context create -w root@ + + # Add a new context named 'prod' in the Uncloud config (~/.config/uncloud/config.yaml). + uc context create -w root@ -c prod + + # Add a new context with a non-root user and custom SSH port and key. + uc context create -w ubuntu@:2222 -i ~/.ssh/mykey +``` + +## Options + +``` + -c, --context string Name of the new context to be created in the Uncloud config to manage the cluster. (default "default") + -h, --help help for create + -i, --ssh-key string Path to SSH private key for remote login (if not already added to SSH agent). (default "~/.ssh/id_ed25519") + -w, --write Write a new Uncloud config, by default the config is only printed to standard output. +``` + +## Options inherited from parent commands + +``` + --connect string Connect to a remote cluster machine without using the Uncloud configuration file. [$UNCLOUD_CONNECT] + Format: [ssh://]user@host[:port], ssh+go://user@host[:port], tcp://host:port, or unix:///path/to/uncloud.sock + --uncloud-config string Path to the Uncloud configuration file. [$UNCLOUD_CONFIG] (default "~/.config/uncloud/config.yaml") +``` + +## See also + +* [uc ctx](uc_ctx.md) - Switch between different cluster contexts. Contains subcommands to manage contexts. + diff --git a/website/docs/9-cli-reference/uc_machine.md b/website/docs/9-cli-reference/uc_machine.md index 92de276c..42d318ce 100644 --- a/website/docs/9-cli-reference/uc_machine.md +++ b/website/docs/9-cli-reference/uc_machine.md @@ -21,7 +21,6 @@ Manage machines in the cluster. * [uc](uc.md) - A CLI tool for managing Uncloud resources such as machines, services, and volumes. * [uc machine add](uc_machine_add.md) - Add a remote machine to a cluster. -* [uc machine ctx](uc_machine_ctx.md) - Add the cluster context to Uncloud configuration file by connecting to the remote machine. * [uc machine init](uc_machine_init.md) - Initialise a new cluster with a remote machine as the first member. * [uc machine logs](uc_machine_logs.md) - View system service logs. * [uc machine ls](uc_machine_ls.md) - List machines in a cluster. From 8e1d2f81cd9a9c36ba3651ccef213d59ddb2785e Mon Sep 17 00:00:00 2001 From: Miek Gieben Date: Tue, 28 Jul 2026 14:29:17 +0200 Subject: [PATCH 9/9] docs Signed-off-by: Miek Gieben --- cmd/uc/context/create.go | 2 +- website/docs/9-cli-reference/uc_ctx_create.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/uc/context/create.go b/cmd/uc/context/create.go index f3e13862..ed19298a 100644 --- a/cmd/uc/context/create.go +++ b/cmd/uc/context/create.go @@ -27,7 +27,7 @@ func NewCreateCommand() *cobra.Command { Short: "Create the cluster context to Uncloud configuration file by connecting to the remote machine.", Long: `Create the cluster context, or add new machines to an existing cluster context. This command adds or updates an (existing) context in your Uncloud config with machines that have a public IP address -configured. +configured. By default the context is printed to standard output, use -w to write it to the Uncloud config. Connection methods: [ssh://]user@host - Use system 'ssh' command with full SSH config support (default, no prefix required) diff --git a/website/docs/9-cli-reference/uc_ctx_create.md b/website/docs/9-cli-reference/uc_ctx_create.md index a0336ba9..57b7808e 100644 --- a/website/docs/9-cli-reference/uc_ctx_create.md +++ b/website/docs/9-cli-reference/uc_ctx_create.md @@ -6,7 +6,7 @@ Create the cluster context to Uncloud configuration file by connecting to the re Create the cluster context, or add new machines to an existing cluster context. This command adds or updates an (existing) context in your Uncloud config with machines that have a public IP address -configured. +configured. By default the context is printed to standard output, use -w to write it to the Uncloud config. Connection methods: [ssh://]user@host - Use system 'ssh' command with full SSH config support (default, no prefix required)