diff --git a/README.md b/README.md index 71c2288..8cd8887 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,11 @@ current implimentations: ## Lastpass +Prerequisites: + +- [lpass](https://github.com/lastpass/lastpass-cli/blob/master/README.md) +- [aws-iam-authenticator](https://docs.aws.amazon.com/eks/latest/userguide/install-aws-iam-authenticator.html) + Create an entry in lastpass with username the AWS_ACCESS_KEY_ID and password the AWS_SECRET_ACCESS_KEY Then configure your kubeconfig as normal but use `aws-iam-authenticator-lpass` as the command @@ -33,6 +38,4 @@ users: - "REPLACE_ME_WITH_YOUR_ROLE_ARN" ``` -You must still have `aws-iam-authenticator` installed. - See https://github.com/kubernetes-sigs/aws-iam-authenticator for more details diff --git a/cmd/aws-iam-authenticator-lpass/main.go b/cmd/aws-iam-authenticator-lpass/main.go index d31197f..29e9026 100644 --- a/cmd/aws-iam-authenticator-lpass/main.go +++ b/cmd/aws-iam-authenticator-lpass/main.go @@ -17,10 +17,10 @@ type Entry struct { } func mergeEnv(original, extra []string) []string { - m := map[string]string{} if len(extra) == 0 { return original } + m := map[string]string{} for _, e := range append(original, extra...) { p := strings.SplitN(e, "=", 2) m[p[0]] = p[1] @@ -54,8 +54,12 @@ func log(msg ...interface{}) { fmt.Println(msg...) } +func errr(msg ...interface{}) { + fmt.Fprintln(os.Stdout, msg...) +} + func fatal(msg ...interface{}) { - log(msg...) + errr(msg...) os.Exit(1) } @@ -72,7 +76,7 @@ func main() { var entries []Entry err = dec.Decode(&entries) if err != nil { - log("Unexpected output from lpass, perhaps multiple entries with same name? Please be more specific") + errr("Unexpected output from lpass, perhaps multiple entries with same name? Please be more specific") fatal(string(out)) } accessKey := entries[0].Username