Unverified Commit 42bc5612 authored by Derek Nola's avatar Derek Nola Committed by GitHub

[Release-1.21] Add `--server flag` to `k3s secrets-encrypt` (#5054)

* Add server flag to access nonlocal/nondefault k3s server (#5016) Signed-off-by: 's avatarDerek Nola <derek.nola@suse.com> * Update gitignore Signed-off-by: 's avatarDerek Nola <derek.nola@suse.com>
parent 03bba667
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
/.tags /.tags
/.idea /.idea
/.trash-cache /.trash-cache
/.vagrant .vagrant/
/.kube /.kube
/.cache /.cache
/.docker /.docker
......
package cmds package cmds
import ( import (
"github.com/rancher/k3s/pkg/version"
"github.com/urfave/cli" "github.com/urfave/cli"
) )
...@@ -9,6 +10,13 @@ const SecretsEncryptCommand = "secrets-encrypt" ...@@ -9,6 +10,13 @@ const SecretsEncryptCommand = "secrets-encrypt"
var EncryptFlags = []cli.Flag{ var EncryptFlags = []cli.Flag{
DataDirFlag, DataDirFlag,
ServerToken, ServerToken,
cli.StringFlag{
Name: "server, s",
Usage: "(cluster) Server to connect to",
EnvVar: version.ProgramUpper + "_URL",
Value: "https://127.0.0.1:6443",
Destination: &ServerConfig.ServerURL,
},
} }
func NewSecretsEncryptCommand(action func(*cli.Context) error, subcommands []cli.Command) cli.Command { func NewSecretsEncryptCommand(action func(*cli.Context) error, subcommands []cli.Command) cli.Command {
......
...@@ -31,9 +31,6 @@ func commandPrep(app *cli.Context, cfg *cmds.Server) (config.Control, *clientacc ...@@ -31,9 +31,6 @@ func commandPrep(app *cli.Context, cfg *cmds.Server) (config.Control, *clientacc
if err != nil { if err != nil {
return controlConfig, nil, err return controlConfig, nil, err
} }
if cfg.ServerURL == "" {
cfg.ServerURL = "https://127.0.0.1:6443"
}
if cfg.Token == "" { if cfg.Token == "" {
fp := filepath.Join(controlConfig.DataDir, "token") fp := filepath.Join(controlConfig.DataDir, "token")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment