mirror of
https://git.vectorsigma.ru/public/k3s.git
synced 2026-08-05 06:19:53 +00:00
[Release-1.21] Add --server flag to k3s secrets-encrypt (#5054)
* Add server flag to access nonlocal/nondefault k3s server (#5016) Signed-off-by: Derek Nola <derek.nola@suse.com> * Update gitignore Signed-off-by: Derek Nola <derek.nola@suse.com>
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -3,7 +3,7 @@
|
||||
/.tags
|
||||
/.idea
|
||||
/.trash-cache
|
||||
/.vagrant
|
||||
.vagrant/
|
||||
/.kube
|
||||
/.cache
|
||||
/.docker
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package cmds
|
||||
|
||||
import (
|
||||
"github.com/rancher/k3s/pkg/version"
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
||||
@@ -9,6 +10,13 @@ const SecretsEncryptCommand = "secrets-encrypt"
|
||||
var EncryptFlags = []cli.Flag{
|
||||
DataDirFlag,
|
||||
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 {
|
||||
|
||||
@@ -31,9 +31,6 @@ func commandPrep(app *cli.Context, cfg *cmds.Server) (config.Control, *clientacc
|
||||
if err != nil {
|
||||
return controlConfig, nil, err
|
||||
}
|
||||
if cfg.ServerURL == "" {
|
||||
cfg.ServerURL = "https://127.0.0.1:6443"
|
||||
}
|
||||
|
||||
if cfg.Token == "" {
|
||||
fp := filepath.Join(controlConfig.DataDir, "token")
|
||||
|
||||
Reference in New Issue
Block a user