Skip to content

Commit

Permalink
Rename kustomize.KustomizePath to kustomize.Path
Browse files Browse the repository at this point in the history
Fixes #1032

Signed-off-by: David Gageot <david@gageot.net>
  • Loading branch information
dgageot committed Sep 27, 2018
1 parent 3ecef93 commit ceeb247
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 7 deletions.
2 changes: 1 addition & 1 deletion integration/examples/annotated-skaffold.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ deploy:
# - namespace:deployment/web-app2

# kustomize:
# kustomizePath: "kustomization.yaml"
# path: .
# kustomize deploys manifests with kubectl.
# kubectl can be passed additional option flags either on every command (Global),
# on creations (Apply) or deletions (Delete).
Expand Down
7 changes: 7 additions & 0 deletions pkg/skaffold/config/transform/transforms.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ func ToV1Alpha3(vc util.VersionedConfig) (util.VersionedConfig, error) {
if err := convert(oldConfig.Deploy, &newDeploy); err != nil {
return nil, errors.Wrap(err, "converting deploy config")
}

// if the helm deploy config was set, then convert ValueFilePath to ValuesFiles
if oldHelmDeploy := oldConfig.Deploy.DeployType.HelmDeploy; oldHelmDeploy != nil {
for i, oldHelmRelease := range oldHelmDeploy.Releases {
Expand All @@ -141,6 +142,12 @@ func ToV1Alpha3(vc util.VersionedConfig) (util.VersionedConfig, error) {
}
}

// the kustomize path parameter was renamed
kustomize := oldConfig.Deploy.KustomizeDeploy
if kustomize != nil {
newDeploy.KustomizeDeploy.Path = kustomize.KustomizePath
}

// convert v1alpha2.Profiles to v1alpha3.Profiles (should be the same)
var newProfiles []v1alpha3.Profile
if oldConfig.Profiles != nil {
Expand Down
4 changes: 2 additions & 2 deletions pkg/skaffold/deploy/kustomize.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,11 @@ func joinPaths(root string, paths []string) []string {

// Dependencies lists all the files that can change what needs to be deployed.
func (k *KustomizeDeployer) Dependencies() ([]string, error) {
return dependenciesForKustomization(k.KustomizePath)
return dependenciesForKustomization(k.Path)
}

func (k *KustomizeDeployer) readManifests(ctx context.Context) (kubectl.ManifestList, error) {
cmd := exec.CommandContext(ctx, "kustomize", "build", k.KustomizePath)
cmd := exec.CommandContext(ctx, "kustomize", "build", k.Path)
out, err := util.RunCmdOut(cmd)
if err != nil {
return nil, errors.Wrap(err, "kustomize build")
Expand Down
5 changes: 3 additions & 2 deletions pkg/skaffold/schema/v1alpha3/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,10 @@ type HelmDeploy struct {
Releases []HelmRelease `yaml:"releases,omitempty"`
}

// KustomizeDeploy contains the configuration needed for deploying with kustomize.
type KustomizeDeploy struct {
KustomizePath string `yaml:"kustomizePath,omitempty"`
Flags KubectlFlags `yaml:"flags,omitempty"`
Path string `yaml:"path,omitempty"`
Flags KubectlFlags `yaml:"flags,omitempty"`
}

type HelmRelease struct {
Expand Down
9 changes: 7 additions & 2 deletions pkg/skaffold/schema/v1alpha3/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,13 @@ func (c *SkaffoldConfig) setDefaultTagger() {
}

func (c *SkaffoldConfig) setDefaultKustomizePath() {
if c.Deploy.KustomizeDeploy != nil && c.Deploy.KustomizeDeploy.KustomizePath == "" {
c.Deploy.KustomizeDeploy.KustomizePath = constants.DefaultKustomizationPath
kustomize := c.Deploy.KustomizeDeploy
if kustomize == nil {
return
}

if kustomize.Path == "" {
kustomize.Path = constants.DefaultKustomizationPath
}
}

Expand Down

0 comments on commit ceeb247

Please sign in to comment.