Skip to content

Commit

Permalink
add parameter releases values (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
naka-gawa authored Sep 9, 2020
1 parent 122d701 commit 38ec39c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/helmfile/release_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ type ReleaseSet struct {
Selector map[string]interface{}
EnvironmentVariables map[string]interface{}
WorkingDirectory string
ReleasesValues map[string]interface{}

// Kubeconfig is the file path to kubeconfig which is set to the KUBECONFIG environment variable on running helmfile
Kubeconfig string
Expand Down Expand Up @@ -75,6 +76,7 @@ func NewReleaseSet(d ResourceRead) (*ReleaseSet, error) {
}

f.Values = d.Get(KeyValues).([]interface{})
f.ReleasesValues = d.Get(KeyReleasesValues).(map[string]interface{})
f.Bin = d.Get(KeyBin).(string)
f.WorkingDirectory = d.Get(KeyWorkingDirectory).(string)

Expand Down Expand Up @@ -170,6 +172,9 @@ func NewCommand(fs *ReleaseSet, args ...string) (*exec.Cmd, error) {
}
flags = append(flags, "--state-values-file", tmpf)
}
for k, v := range fs.ReleasesValues {
args = append(args, "--set", fmt.Sprintf("%s=%s", k, v))
}
cmd := exec.Command(*helmfileBin, append(flags, args...)...)
cmd.Dir = fs.WorkingDirectory
cmd.Env = append(os.Environ(), readEnvironmentVariables(fs.EnvironmentVariables, "KUBECONFIG")...)
Expand Down
6 changes: 6 additions & 0 deletions pkg/helmfile/resource_release_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const KeyError = "error"
const KeyApplyOutput = "apply_output"
const KeyDirty = "dirty"
const KeyConcurrency = "concurrency"
const KeyReleasesValues = "releases_values"

const HelmfileDefaultPath = "helmfile.yaml"

Expand Down Expand Up @@ -134,6 +135,11 @@ var ReleaseSetSchema = map[string]*schema.Schema{
Optional: true,
Default: 0,
},
KeyReleasesValues: {
Type: schema.TypeMap,
Optional: true,
ForceNew: false,
},
}

func resourceShellHelmfileReleaseSet() *schema.Resource {
Expand Down

0 comments on commit 38ec39c

Please sign in to comment.