-
-
Notifications
You must be signed in to change notification settings - Fork 376
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add local install mode for k3sup install
Closes: #2 This feature allows the k3sup binary to be used to install k3s within cloud-init, through bash, or for general local usage without needing to pass through ssh. Tested against a Civo Ubuntu node both remotely and with an IP given. The new flag is --local. Signed-off-by: Alex Ellis (OpenFaaS Ltd) <[email protected]>
- Loading branch information
Showing
4 changed files
with
118 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package ssh | ||
|
||
import ( | ||
goexecute "github.com/alexellis/go-execute/pkg/v1" | ||
) | ||
|
||
type CommandOperator interface { | ||
Execute(command string) (CommandRes, error) | ||
} | ||
|
||
type ExecOperator struct { | ||
} | ||
|
||
func (ex ExecOperator) Execute(command string) (CommandRes, error) { | ||
|
||
task := goexecute.ExecTask{ | ||
Command: command, | ||
Shell: true, | ||
} | ||
|
||
res, err := task.Execute() | ||
if err != nil { | ||
return CommandRes{}, err | ||
} | ||
|
||
return CommandRes{ | ||
StdErr: []byte(res.Stderr), | ||
StdOut: []byte(res.Stdout), | ||
}, nil | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters