Skip to content

Commit

Permalink
Fix kustomize render to file
Browse files Browse the repository at this point in the history
Signed-off-by: Armin Buerkle <[email protected]>
  • Loading branch information
arminbuerkle committed Dec 10, 2019
1 parent ce818aa commit df171be
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
13 changes: 5 additions & 8 deletions pkg/skaffold/deploy/kustomize.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ limitations under the License.
package deploy

import (
"bufio"
"context"
"fmt"
"io"
Expand Down Expand Up @@ -186,18 +185,16 @@ func (k *KustomizeDeployer) Render(ctx context.Context, out io.Writer, builds []

manifestOut := out
if filepath != "" {
f, err := os.Open(filepath)
f, err := os.OpenFile(filepath, os.O_RDWR|os.O_CREATE, 0666)
if err != nil {
return errors.Wrap(err, "opening file for writing manifests")
}
manifestOut = bufio.NewWriter(f)
defer f.Close()
f.WriteString(manifests.String() + "\n")
return nil
}

for _, m := range manifests {
if _, err := fmt.Fprintln(manifestOut, string(m)); err != nil {
return errors.Wrap(err, "writing manifests")
}
}
fmt.Fprintln(manifestOut, manifests.String())
return nil
}

Expand Down
1 change: 0 additions & 1 deletion pkg/skaffold/deploy/kustomize_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,6 @@ spec:
name: image1
- image: gcr.io/project/image2:tag2
name: image2
`,
},
}
Expand Down

0 comments on commit df171be

Please sign in to comment.