Skip to content

Commit

Permalink
remove ssh-add and fix calling appendKnownHelper when not needed
Browse files Browse the repository at this point in the history
  • Loading branch information
ComradeProgrammer committed Aug 10, 2023
1 parent 8cdc5c7 commit df3f5c7
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 11 deletions.
12 changes: 5 additions & 7 deletions cmd/minikube/cmd/docker-env.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ type DockerShellConfig struct {
var (
noProxy bool
sshHost bool
sshAdd bool
dockerUnset bool
defaultNoProxyGetter NoProxyGetter
)
Expand Down Expand Up @@ -324,9 +323,10 @@ docker-cli install instructions: https://minikube.sigs.k8s.io/docs/tutorials/doc
// docker-env on containerd depends on nerdctld (https://github.com/afbjorklund/nerdctld) as "docker" daeomn
// and nerdctld daemon must be used with ssh connection (it is set in kicbase image's Dockerfile)
// so directly set --ssh-host --ssh-add to true, even user didn't specify them
sshAdd = true
sshHost = true
}

if sshHost {
// start the ssh-agent
if err := sshagent.Start(cname); err != nil {
exit.Message(reason.SSHAgentStart, err.Error())
Expand Down Expand Up @@ -405,7 +405,7 @@ docker-cli install instructions: https://minikube.sigs.k8s.io/docs/tutorials/doc
exit.Error(reason.InternalDockerScript, "Error generating set output", err)
}

if sshAdd {
if sshHost {
klog.Infof("Adding %v", d.GetSSHKeyPath())

path, err := exec.LookPath("ssh-add")
Expand All @@ -420,10 +420,9 @@ docker-cli install instructions: https://minikube.sigs.k8s.io/docs/tutorials/doc
if err != nil {
exit.Error(reason.IfSSHClient, "Error with ssh-add", err)
}
// eventually, run something similar to ssh --append-known
appendKnownHelper(nodeName, true)
}

// eventually, run something similar to ssh --append-known
appendKnownHelper(nodeName, true)
},
}

Expand Down Expand Up @@ -685,7 +684,6 @@ func init() {
defaultNoProxyGetter = &EnvNoProxyGetter{}
dockerEnvCmd.Flags().BoolVar(&noProxy, "no-proxy", false, "Add machine IP to NO_PROXY environment variable")
dockerEnvCmd.Flags().BoolVar(&sshHost, "ssh-host", false, "Use SSH connection instead of HTTPS (port 2376)")
dockerEnvCmd.Flags().BoolVar(&sshAdd, "ssh-add", false, "Add SSH identity key to SSH authentication agent")
dockerEnvCmd.Flags().StringVar(&shell.ForceShell, "shell", "", "Force environment to be configured for a specified shell: [fish, cmd, powershell, tcsh, bash, zsh], default is auto-detect")
dockerEnvCmd.Flags().StringVarP(&outputFormat, "output", "o", "", "One of 'text', 'yaml' or 'json'.")
dockerEnvCmd.Flags().BoolVarP(&dockerUnset, "unset", "u", false, "Unset variables instead of setting them")
Expand Down
1 change: 0 additions & 1 deletion site/content/en/docs/commands/docker-env.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ minikube docker-env [flags]
--no-proxy Add machine IP to NO_PROXY environment variable
-o, --output string One of 'text', 'yaml' or 'json'.
--shell string Force environment to be configured for a specified shell: [fish, cmd, powershell, tcsh, bash, zsh], default is auto-detect
--ssh-add Add SSH identity key to SSH authentication agent
--ssh-host Use SSH connection instead of HTTPS (port 2376)
-u, --unset Unset variables instead of setting them
```
Expand Down
1 change: 0 additions & 1 deletion translations/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
"A set of key=value pairs that describe feature gates for alpha/experimental features.": "",
"Access the Kubernetes dashboard running within the minikube cluster": "Dostęp do dashboardu uruchomionego w klastrze kubernetesa w minikube",
"Access to ports below 1024 may fail on Windows with OpenSSH clients older than v8.1. For more information, see: https://minikube.sigs.k8s.io/docs/handbook/accessing/#access-to-ports-1024-on-windows-requires-root-permission": "",
"Add SSH identity key to SSH authentication agent": "",
"Add an image into minikube as a local cache, or delete, reload the cached images": "",
"Add an image to local cache.": "Dodaj obraz do lokalnego cache",
"Add host key to SSH known_hosts file": "Dodaj klucz hosta do pliku known_hosts",
Expand Down
1 change: 0 additions & 1 deletion translations/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
"A set of key=value pairs that describe feature gates for alpha/experimental features.": "",
"Access the Kubernetes dashboard running within the minikube cluster": "",
"Access to ports below 1024 may fail on Windows with OpenSSH clients older than v8.1. For more information, see: https://minikube.sigs.k8s.io/docs/handbook/accessing/#access-to-ports-1024-on-windows-requires-root-permission": "",
"Add SSH identity key to SSH authentication agent": "",
"Add an image into minikube as a local cache, or delete, reload the cached images": "",
"Add an image to local cache.": "",
"Add host key to SSH known_hosts file": "",
Expand Down
1 change: 0 additions & 1 deletion translations/strings.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
"A set of key=value pairs that describe feature gates for alpha/experimental features.": "",
"Access the Kubernetes dashboard running within the minikube cluster": "",
"Access to ports below 1024 may fail on Windows with OpenSSH clients older than v8.1. For more information, see: https://minikube.sigs.k8s.io/docs/handbook/accessing/#access-to-ports-1024-on-windows-requires-root-permission": "",
"Add SSH identity key to SSH authentication agent": "",
"Add an image into minikube as a local cache, or delete, reload the cached images": "",
"Add an image to local cache.": "",
"Add host key to SSH known_hosts file": "",
Expand Down

0 comments on commit df3f5c7

Please sign in to comment.