Skip to content

Commit

Permalink
Update helm version to v2.15.2
Browse files Browse the repository at this point in the history
Version v2.15.2 includes some incremental fixes.

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <[email protected]>
  • Loading branch information
alexellis committed Nov 3, 2019
1 parent 3c72e62 commit f978df8
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 59 deletions.
59 changes: 59 additions & 0 deletions pkg/cmd/kubernetes_exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,19 @@ package cmd

import (
"fmt"
"io/ioutil"
"log"
"net/http"
"net/url"
"os"
"path"
"strings"

execute "github.com/alexellis/go-execute/pkg/v1"
)

const helmVersion = "v2.15.2"

func fetchChart(path, chart string) error {
mkErr := os.MkdirAll(path, 0700)

Expand Down Expand Up @@ -198,3 +203,57 @@ func tryDownloadHelm(userPath, clientArch, clientOS string) (string, error) {
}
return helmBinaryPath, nil
}

// getClientArch returns a pair of arch and os
func getClientArch() (string, string) {
task := execute.ExecTask{Command: "uname", Args: []string{"-m"}}
res, err := task.Execute()
if err != nil {
log.Println(err)
}

arch := strings.TrimSpace(res.Stdout)

taskOS := execute.ExecTask{Command: "uname", Args: []string{"-s"}}
resOS, errOS := taskOS.Execute()
if errOS != nil {
log.Println(errOS)
}

os := strings.TrimSpace(resOS.Stdout)

return arch, os
}

func getHelmURL(arch, os, version string) string {
archSuffix := "amd64"
osSuffix := strings.ToLower(os)

if strings.HasPrefix(arch, "armv7") {
archSuffix = "arm"
} else if strings.HasPrefix(arch, "aarch64") {
archSuffix = "arm64"
}

return fmt.Sprintf("https://get.helm.sh/helm-%s-%s-%s.tar.gz", version, osSuffix, archSuffix)
}

func downloadHelm(userPath, clientArch, clientOS string) error {
helmURL := getHelmURL(clientArch, clientOS, helmVersion)
fmt.Println(helmURL)
parsedURL, _ := url.Parse(helmURL)

res, err := http.DefaultClient.Get(parsedURL.String())
if err != nil {
return err
}

defer res.Body.Close()
r := ioutil.NopCloser(res.Body)
untarErr := Untar(r, path.Join(userPath, ".bin"))
if untarErr != nil {
return untarErr
}

return nil
}
59 changes: 0 additions & 59 deletions pkg/cmd/openfaas_app.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,12 @@ package cmd

import (
"fmt"
"io/ioutil"
"log"
"net/http"
"net/url"
"os"
"path"
"strconv"
"strings"

execute "github.com/alexellis/go-execute/pkg/v1"

"github.com/sethvargo/go-password/password"

"github.com/alexellis/k3sup/pkg/config"
Expand Down Expand Up @@ -180,60 +175,6 @@ Thank you for using k3sup!`)
return openfaas
}

// getClientArch returns a pair of arch and os
func getClientArch() (string, string) {
task := execute.ExecTask{Command: "uname", Args: []string{"-m"}}
res, err := task.Execute()
if err != nil {
log.Println(err)
}

arch := strings.TrimSpace(res.Stdout)

taskOS := execute.ExecTask{Command: "uname", Args: []string{"-s"}}
resOS, errOS := taskOS.Execute()
if errOS != nil {
log.Println(errOS)
}

os := strings.TrimSpace(resOS.Stdout)

return arch, os
}

func getHelmURL(arch, os, version string) string {
archSuffix := "amd64"
osSuffix := strings.ToLower(os)

if strings.HasPrefix(arch, "armv7") {
archSuffix = "arm"
} else if strings.HasPrefix(arch, "aarch64") {
archSuffix = "arm64"
}

return fmt.Sprintf("https://get.helm.sh/helm-%s-%s-%s.tar.gz", version, osSuffix, archSuffix)
}

func downloadHelm(userPath, clientArch, clientOS string) error {
helmURL := getHelmURL(clientArch, clientOS, "v2.14.3")
fmt.Println(helmURL)
parsedURL, _ := url.Parse(helmURL)

res, err := http.DefaultClient.Get(parsedURL.String())
if err != nil {
return err
}

defer res.Body.Close()
r := ioutil.NopCloser(res.Body)
untarErr := Untar(r, path.Join(userPath, ".bin"))
if untarErr != nil {
return untarErr
}

return nil
}

func getValuesSuffix(arch string) string {
var valuesSuffix string
switch arch {
Expand Down

0 comments on commit f978df8

Please sign in to comment.