Skip to content

Commit

Permalink
go fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
akashshinde committed Dec 23, 2019
1 parent c454279 commit eff0686
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 14 deletions.
2 changes: 1 addition & 1 deletion pkg/helm_actions/install_chart.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ func InstallChart(ns, name, url string, conf *action.Configuration) (interface{}
cmd := action.NewInstall(conf)
cmd.Namespace = ns

name,chart,err := cmd.NameAndChart([]string{name, url})
name, chart, err := cmd.NameAndChart([]string{name, url})
if err != nil {
return nil, err
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/helm_actions/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func RenderManifests(name string, url string, conf *action.Configuration) (inter
client.Replace = true // Skip the name check
client.ClientOnly = !validate

name,chart,err := client.NameAndChart([]string{name, url})
name, chart, err := client.NameAndChart([]string{name, url})
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -88,7 +88,7 @@ func RenderManifests(name string, url string, conf *action.Configuration) (inter
}
}
if missing {
return nil, fmt.Errorf("could not find template %s in chart", f)
return nil, fmt.Errorf("could not find template %s in chart", f)
}
for _, m := range manifestsToRender {
response[f] = m
Expand All @@ -99,4 +99,4 @@ func RenderManifests(name string, url string, conf *action.Configuration) (inter
fmt.Fprintf(&output, "%s", manifests.String())
}
return output.String(), nil
}
}
2 changes: 1 addition & 1 deletion pkg/helm_actions/upgrade_release.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ func UpgradeRelease(ns, name, url string, conf *action.Configuration) (interface
cmd := action.NewInstall(conf)
cmd.Namespace = ns

name,chart,err := cmd.NameAndChart([]string{name, url})
name, chart, err := cmd.NameAndChart([]string{name, url})
if err != nil {
return nil, err
}
Expand Down
7 changes: 2 additions & 5 deletions pkg/helm_agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ import (
var settings = cli.New()

func GetActionConfigurations(host, ns, token string) *action.Configuration {
//config, _ := clientcmd.BuildConfigFromFlags("", "/Users/akash/kubeconfig")
//config, _ := rest.InClusterConfig()
// creates the clientset
conf := &rest.Config{
Host: host,
BearerToken: token,
Expand All @@ -26,7 +23,7 @@ func GetActionConfigurations(host, ns, token string) *action.Configuration {
tr := true
kubeConf := &genericclioptions.ConfigFlags{
APIServer: &host,
Insecure: &tr ,
Insecure: &tr,
BearerToken: &token,
}
store := createStorage(ns, clientset)
Expand All @@ -47,4 +44,4 @@ func createStorage(namespace string, clientset *kubernetes.Clientset) *storage.S
d.Log = klog.Infof
store = storage.Init(d)
return store
}
}
8 changes: 4 additions & 4 deletions pkg/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ func (s *Server) handleOpenShiftTokenDeletion(user *auth.User, w http.ResponseWr
resp.Body.Close()
}

func (s *Server) handleHelmRenderManifests(user *auth.User, w http.ResponseWriter, r *http.Request) {
func (s *Server) handleHelmRenderManifests(user *auth.User, w http.ResponseWriter, r *http.Request) {
params := r.URL.Query()
conf := helm_agent.GetActionConfigurations(s.KubeAPIServerURL, "openshift-helm", user.Token)
resp, err := helm_actions.RenderManifests(params.Get("name"), params.Get("url"), conf)
Expand All @@ -434,10 +434,10 @@ func (s *Server) handleHelmRenderManifests(user *auth.User, w http.ResponseWrite
w.Write([]byte(resp.(string)))
}

func (s *Server) handleHelmInstall(user *auth.User, w http.ResponseWriter, r *http.Request) {
func (s *Server) handleHelmInstall(user *auth.User, w http.ResponseWriter, r *http.Request) {
params := r.URL.Query()
conf := helm_agent.GetActionConfigurations(s.KubeAPIServerURL, "openshift-helm", user.Token)
resp, err := helm_actions.InstallChart(params.Get("ns"),params.Get("name"), params.Get("url"), conf)
resp, err := helm_actions.InstallChart(params.Get("ns"), params.Get("name"), params.Get("url"), conf)
if err != nil {
sendResponse(w, http.StatusBadGateway, apiError{fmt.Sprintf("Failed to install helm chart: %v", err)})
}
Expand All @@ -446,7 +446,7 @@ func (s *Server) handleHelmInstall(user *auth.User, w http.ResponseWriter, r *ht
w.Write(res)
}

func (s *Server) handleHelmList(user *auth.User, w http.ResponseWriter, r *http.Request) {
func (s *Server) handleHelmList(user *auth.User, w http.ResponseWriter, r *http.Request) {
conf := helm_agent.GetActionConfigurations(s.KubeAPIServerURL, "", user.Token)
resp, err := helm_actions.ListReleases(conf)
if err != nil {
Expand Down

0 comments on commit eff0686

Please sign in to comment.