Skip to content

Commit

Permalink
Merge pull request #350 from replicatedhq/divolgin/multi-doc
Browse files Browse the repository at this point in the history
Split multi-doc files and honor exclude annotation on app updates
  • Loading branch information
divolgin committed Feb 24, 2020
2 parents b91f847 + 91d497b commit 9df6339
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions pkg/base/render.go
Expand Up @@ -14,6 +14,7 @@ type RenderOptions struct {
LocalRegistryNamespace string
LocalRegistryUsername string
LocalRegistryPassword string
ExcludeKotsKinds bool
Log *logger.Logger
}

Expand Down
12 changes: 11 additions & 1 deletion pkg/base/replicated.go
Expand Up @@ -98,7 +98,16 @@ func renderReplicated(u *upstreamtypes.Upstream, renderOptions *RenderOptions) (
return nil, errors.Wrapf(err, "failed to convert upstream file %s to base", upstreamFile.Path)
}

base.Files = append(base.Files, baseFile)
baseFiles := convertToSingleDocs([]BaseFile{baseFile})
for _, f := range baseFiles {
include, err := f.ShouldBeIncludedInBaseKustomization(renderOptions.ExcludeKotsKinds)
if err != nil {
return nil, errors.Wrapf(err, "failed to check if base file %s should be included", f.Path)
}
if include {
base.Files = append(base.Files, f)
}
}
}

// render helm charts that were specified
Expand Down Expand Up @@ -186,6 +195,7 @@ func renderReplicated(u *upstreamtypes.Upstream, renderOptions *RenderOptions) (
SplitMultiDocYAML: true,
Namespace: namespace,
HelmOptions: localValues,
ExcludeKotsKinds: renderOptions.ExcludeKotsKinds,
Log: nil,
})
if err != nil {
Expand Down
1 change: 1 addition & 0 deletions pkg/pull/pull.go
Expand Up @@ -236,6 +236,7 @@ func Pull(upstreamURI string, pullOptions PullOptions) (string, error) {
LocalRegistryNamespace: pullOptions.RewriteImageOptions.Namespace,
LocalRegistryUsername: pullOptions.RewriteImageOptions.Username,
LocalRegistryPassword: pullOptions.RewriteImageOptions.Password,
ExcludeKotsKinds: pullOptions.ExcludeKotsKinds,
Log: log,
}
log.ActionWithSpinner("Creating base")
Expand Down
1 change: 1 addition & 0 deletions pkg/rewrite/rewrite.go
Expand Up @@ -94,6 +94,7 @@ func Rewrite(rewriteOptions RewriteOptions) error {
LocalRegistryNamespace: rewriteOptions.RegistryNamespace,
LocalRegistryUsername: rewriteOptions.RegistryUsername,
LocalRegistryPassword: rewriteOptions.RegistryPassword,
ExcludeKotsKinds: rewriteOptions.ExcludeKotsKinds,
Log: log,
}
log.ActionWithSpinner("Creating base")
Expand Down

0 comments on commit 9df6339

Please sign in to comment.