Skip to content

Commit 2859828

Browse files
authored
Merge pull request #220 from covexo/fixes
Resolve #108
2 parents 14b5533 + ffcb31f commit 2859828

3 files changed

Lines changed: 22 additions & 9 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: 19 additions & 5 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 {
@@ -557,7 +561,12 @@ func (cmd *UpCmd) startSync() []*synctool.SyncConfig {
557561
labels = append(labels, key+"="+*value)
558562
}
559563

560-
pod, err := kubectl.GetFirstRunningPod(cmd.kubectl, strings.Join(labels, ", "), *config.DevSpace.Release.Namespace)
564+
namespace := *config.DevSpace.Release.Namespace
565+
if syncPath.Namespace != nil && *syncPath.Namespace != "" {
566+
namespace = *syncPath.Namespace
567+
}
568+
569+
pod, err := kubectl.GetFirstRunningPod(cmd.kubectl, strings.Join(labels, ", "), namespace)
561570

562571
if err != nil {
563572
log.Panicf("Unable to list devspace pods: %s", err.Error())
@@ -608,7 +617,12 @@ func (cmd *UpCmd) startPortForwarding() {
608617
labels = append(labels, key+"="+*value)
609618
}
610619

611-
pod, err := kubectl.GetFirstRunningPod(cmd.kubectl, strings.Join(labels, ", "), *config.DevSpace.Release.Namespace)
620+
namespace := *config.DevSpace.Release.Namespace
621+
if portForwarding.Namespace != nil && *portForwarding.Namespace != "" {
622+
namespace = *portForwarding.Namespace
623+
}
624+
625+
pod, err := kubectl.GetFirstRunningPod(cmd.kubectl, strings.Join(labels, ", "), namespace)
612626

613627
if err != nil {
614628
log.Errorf("Unable to list devspace pods: %s", err.Error())

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)