Skip to content

Commit

Permalink
Support values for install command
Browse files Browse the repository at this point in the history
  • Loading branch information
Anirudh M authored and kaustubhkurve committed Aug 6, 2020
1 parent 4114f3c commit 618e420
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
3 changes: 2 additions & 1 deletion pkg/cli/values/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ limitations under the License.
package values

import (
"fmt"
"io/ioutil"
"net/url"
"os"
Expand All @@ -39,7 +40,7 @@ type Options struct {
// MergeValues merges values from files specified via -f/--values and directly
// via --set, --set-string, or --set-file, marshaling them to YAML
func (opts *Options) MergeValues(p getter.Providers) (map[string]interface{}, error) {

fmt.Println("%+v", opts)
base := map[string]interface{}{}

// User specified a values files via -f/--values
Expand Down
1 change: 1 addition & 0 deletions pkg/http/api/install/installcontract.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ type InstallRequest struct {
ReleaseName string
ReleaseNamespace string
ChartPath string
Values string
}

type InstallResponse struct {
Expand Down
9 changes: 6 additions & 3 deletions pkg/http/api/install/installhandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ func Handler() http.Handler {
request.ReleaseName = req.Header.Get("Release-Name")
request.ReleaseNamespace = req.Header.Get("Release-Namespace")
request.ChartPath = req.Header.Get("Chart-Path")
request.Values = req.Header.Get("Values")

valueOpts := &values.Options{}
valueOpts.Values = append(valueOpts.Values, request.Values)

status, releaseStatus, err := InstallChart(request.ReleaseName, request.ReleaseNamespace, request.ChartPath, valueOpts)
if err != nil {
Expand All @@ -54,15 +57,15 @@ func InstallChart(releaseName, releaseNamespace, chartPath string, valueOpts *va
install := action.NewInstall(servercontext.App().ActionConfig)
install.ReleaseName = releaseName
install.Namespace = releaseNamespace
vals, err := valueOpts.MergeValues(getter.All(servercontext.App().Config))

cp, err := install.ChartPathOptions.LocateChart(chartPath, servercontext.App().Config)
vals, err := valueOpts.MergeValues(getter.All(servercontext.App().Config))
if err != nil {
fmt.Printf("error in locating chart: %v", err)
return false, "", err
}

cp, err := install.ChartPathOptions.LocateChart(chartPath, servercontext.App().Config)
if err != nil {
fmt.Printf("error in locating chart: %v", err)
return false, "", err
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/http/api/upgrade/upgradehandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import (
"fmt"
"net/http"

"helm.sh/helm/v3/cmd/endpoints/install"
"helm.sh/helm/v3/cmd/servercontext"
"helm.sh/helm/v3/pkg/action"
"helm.sh/helm/v3/pkg/chart/loader"
"helm.sh/helm/v3/pkg/cli/values"
"helm.sh/helm/v3/pkg/getter"
"helm.sh/helm/v3/pkg/http/api/install"
"helm.sh/helm/v3/pkg/servercontext"
"helm.sh/helm/v3/pkg/storage/driver"
)

Expand Down

0 comments on commit 618e420

Please sign in to comment.