Skip to content

Commit ffcb31f

Browse files
committed
Fix reading from values.yaml
1 parent 4db0085 commit ffcb31f

3 files changed

Lines changed: 10 additions & 7 deletions

File tree

cmd/init.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,12 +153,11 @@ func (cmd *InitCmd) Run(cobraCmd *cobra.Command, args []string) {
153153
createChart := cmd.flags.overwrite
154154

155155
if !cmd.flags.overwrite {
156-
_, dockerfileNotFound := os.Stat(cmd.workdir + "/Dockerfile")
157156
_, chartDirNotFound := os.Stat(cmd.workdir + "/chart")
158157

159-
if dockerfileNotFound == nil || chartDirNotFound == nil {
158+
if chartDirNotFound == nil {
160159
overwriteAnswer := stdinutil.GetFromStdin(&stdinutil.GetFromStdinParams{
161-
Question: "Do you want to overwrite the Dockerfile and the existing files in /chart? (yes | no)",
160+
Question: "Do you want to overwrite the existing files in /chart? (yes | no)",
162161
DefaultValue: "no",
163162
ValidationRegexPattern: "^(yes)|(no)$",
164163
})

cmd/up.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,10 @@ func (cmd *UpCmd) deployChart() {
437437
values := map[interface{}]interface{}{}
438438
overwriteValues := map[interface{}]interface{}{}
439439

440-
yamlutil.ReadYamlFromFile(chartPath, values)
440+
err := yamlutil.ReadYamlFromFile(chartPath+"values.yaml", values)
441+
if err != nil {
442+
log.Fatalf("Couldn't deploy chart, error reading from chart values %s: %v", chartPath+"values.yaml", err)
443+
}
441444

442445
containerValues := map[string]interface{}{}
443446

@@ -449,14 +452,15 @@ func (cmd *UpCmd) deployChart() {
449452
container["command"] = []string{"sleep"}
450453
container["args"] = []string{"99999999"}
451454
}
455+
452456
containerValues[imageName] = container
453457
}
454458

455-
pullSecrets := []string{}
459+
pullSecrets := []interface{}{}
456460
existingPullSecrets, pullSecretsExisting := values["pullSecrets"]
457461

458462
if pullSecretsExisting {
459-
pullSecrets = existingPullSecrets.([]string)
463+
pullSecrets = existingPullSecrets.([]interface{})
460464
}
461465

462466
for _, registryConf := range *config.Registries {

pkg/util/yamlutil/yaml.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ func WriteYamlToFile(yamlData interface{}, filePath string) error {
2020
//ReadYamlFromFile reads a yaml file
2121
func ReadYamlFromFile(filePath string, yamlTarget interface{}) error {
2222
yamlFile, err := ioutil.ReadFile(filePath)
23-
2423
if err != nil {
2524
return err
2625
}
26+
2727
return yaml.Unmarshal(yamlFile, yamlTarget)
2828
}

0 commit comments

Comments
 (0)