Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move deployers into separate packages #4812

Merged
merged 3 commits into from
Sep 22, 2020

Conversation

nkubala
Copy link
Contributor

@nkubala nkubala commented Sep 21, 2020

this is a non-functional refactor to move each deployer into its own package, to improve readability of the code and clarity around what methods apply where. this will also make it easier to further consolidate and/or make changes to shared deploy code in the future.

review guide:

  • creates the following packages in pkg/skaffold/deploy: kubectl, kustomize, helm, kpt, label, status, util
  • pkg/skaffold/deploy/util contains shared util code related to LogFile and StringSet
  • also creates pkg/skaffold/deploy/types, which contains shared types across other deploy packages
  • moves manifest processing code out of pkg/skaffold/deploy/kubectl and into pkg/skaffold/kubernetes/manifest, since it is shared
  • exposes a few private methods which were being shared across deployers. it is now clear based on imports which packages these methods belong to (e.g. kustomize.BuildCommandArgs being used in pkg/skaffold/deploy/kpt)
  • moves shared testing constants around and exposed as public

follow-up work: move kubectl.Config out of pkg/skaffold/deploy/kubectl, since it is shared outside of this package.

@codecov
Copy link

codecov bot commented Sep 21, 2020

Codecov Report

Merging #4812 into master will decrease coverage by 0.02%.
The diff coverage is 74.41%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #4812      +/-   ##
==========================================
- Coverage   71.77%   71.75%   -0.03%     
==========================================
  Files         348      353       +5     
  Lines       12082    12087       +5     
==========================================
+ Hits         8672     8673       +1     
+ Misses       2771     2770       -1     
- Partials      639      644       +5     
Impacted Files Coverage Δ
cmd/skaffold/app/cmd/filter.go 26.19% <0.00%> (ø)
pkg/skaffold/deploy/label/labels.go 45.58% <ø> (ø)
pkg/skaffold/deploy/util/logfile.go 84.61% <ø> (ø)
pkg/skaffold/initializer/analyze/helm.go 100.00% <ø> (ø)
pkg/skaffold/initializer/analyze/kustomize.go 66.66% <ø> (ø)
pkg/skaffold/kubernetes/manifest/labels.go 85.18% <ø> (ø)
pkg/skaffold/kubernetes/manifest/manifests.go 94.59% <ø> (ø)
pkg/skaffold/kubernetes/manifest/namespaces.go 88.88% <ø> (ø)
pkg/skaffold/kubernetes/manifest/visitor.go 95.00% <ø> (ø)
pkg/skaffold/runner/runner.go 0.00% <ø> (ø)
... and 30 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 35cee15...00c9d3d. Read the comment docs.

Copy link
Contributor

@yuwenma yuwenma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Took a quick pass. Added some minor suggestions for the previous golang code style.

@nkubala nkubala dismissed yuwenma’s stale review September 21, 2020 23:54

addressed all changes

@@ -103,5 +78,5 @@ func (m DeployerMux) Render(ctx context.Context, w io.Writer, as []build.Artifac
}

allResources := strings.Join(resources, "\n---\n")
return outputRenderedManifests(allResources, filepath, w)
return manifest.OutputRenderedManifests(allResources, filepath, w)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OutputRenderedManifests to probably OutputRender

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WDYT about manifest.Write()? the fact that the manifests are rendered seems like an implementation detail to me

Copy link
Contributor

@gsquared94 gsquared94 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, other than turning off lint via //nolint:golint. Maybe we appease the linters instead?

@nkubala nkubala merged commit c5b66da into GoogleContainerTools:master Sep 22, 2020
@nkubala nkubala deleted the deploy-packages branch September 22, 2020 17:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants