Skip to content

Commit

Permalink
remove ExecuteOverSSHEnabled function (#1048)
Browse files Browse the repository at this point in the history
* remove ExecuteOverSSHEnabled function

Signed-off-by: Ramiro Berrelleza <rberrelleza@gmail.com>
  • Loading branch information
rberrelleza committed Sep 22, 2020
1 parent 32a1205 commit a778726
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 17 deletions.
2 changes: 1 addition & 1 deletion cmd/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func executeExec(ctx context.Context, dev *model.Dev, args []string) error {
dev.Container = p.Spec.Containers[0].Name
}

if dev.ExecuteOverSSHEnabled() || dev.RemoteModeEnabled() {
if dev.RemoteModeEnabled() {
log.Infof("executing remote command over SSH")
dev.LoadRemote(ssh.GetPublicKey())
return ssh.Exec(ctx, dev.RemotePort, true, os.Stdin, os.Stdout, os.Stderr, wrapped)
Expand Down
9 changes: 5 additions & 4 deletions cmd/init/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ func supportsPersistentVolumes(namespace, k8sContext string) bool {
log.Debugf("checking persistent volumes support in your cluster...")
c, _, currentNamespace, err := k8Client.GetLocal(k8sContext)
if err != nil {
log.Debugf("couldn't get kubernetes local client: %s", err.Error())
log.Infof("couldn't get kubernetes local client: %s", err.Error())
return false
}
if namespace == "" {
Expand All @@ -214,7 +214,7 @@ func supportsPersistentVolumes(namespace, k8sContext string) bool {

ns, err := namespaces.Get(namespace, c)
if err != nil {
log.Debugf("failed to get the current namespace: %s", err.Error())
log.Infof("failed to get the current namespace: %s", err.Error())
return false
}

Expand All @@ -224,7 +224,7 @@ func supportsPersistentVolumes(namespace, k8sContext string) bool {

stClassList, err := c.StorageV1().StorageClasses().List(metav1.ListOptions{})
if err != nil {
log.Debugf("error getting storage classes: %s", err.Error())
log.Infof("error getting storage classes: %s", err.Error())
return false
}

Expand All @@ -234,7 +234,8 @@ func supportsPersistentVolumes(namespace, k8sContext string) bool {
return true
}
}
log.Debugf("default storage class not found")

log.Infof("default storage class not found")
return false
}

Expand Down
6 changes: 1 addition & 5 deletions cmd/up/up.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,6 @@ func loadDevOverrides(dev *model.Dev, namespace, k8sContext string, forcePull bo
dev.RemotePort = remote
}

if dev.ExecuteOverSSHEnabled() {
log.Info("execute over SSH mode enabled")
}

if dev.RemoteModeEnabled() {
if err := sshKeys(); err != nil {
return err
Expand Down Expand Up @@ -591,7 +587,7 @@ func (up *upContext) devMode(d *appsv1.Deployment, create bool) error {
}

func (up *upContext) forwards() error {
if up.Dev.ExecuteOverSSHEnabled() || up.Dev.RemoteModeEnabled() {
if up.Dev.RemoteModeEnabled() {
return up.sshForwards()
}

Expand Down
10 changes: 3 additions & 7 deletions pkg/model/dev.go
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,9 @@ func (dev *Dev) RemoteModeEnabled() bool {
return false
}

if dev.ExecuteOverSSHEnabled() {
_, ok := os.LookupEnv("OKTETO_EXECUTE_SSH")
if ok {
log.Info("execute over SSH mode enabled")
return true
}

Expand All @@ -812,12 +814,6 @@ func (dev *Dev) RemoteModeEnabled() bool {
return len(dev.Reverse) > 0
}

// ExecuteOverSSHEnabled returns true if execute over SSH is enabled
func (dev *Dev) ExecuteOverSSHEnabled() bool {
_, ok := os.LookupEnv("OKTETO_EXECUTE_SSH")
return ok
}

// GetKeyName returns the secret key name
func (s *Secret) GetKeyName() string {
return fmt.Sprintf("dev-secret-%s", filepath.Base(s.RemotePath))
Expand Down

0 comments on commit a778726

Please sign in to comment.