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

Refactor KanikoBuild into KanikoArtifact and Cluster #1797

Merged
merged 10 commits into from Mar 15, 2019

Conversation

priyawadhwa
Copy link
Contributor

This PR refactors kaniko, taking the preexisting KanikoBuild type and splitting it up into a per artifact KanikoArtifact and Cluster type.

KanikoArtifact now contains artifact specified fields (buildcontext, cache, additional flags etc.), whileClusterDetails contains fields specific to the cluster (namespace, timeout, secrets). This makes more sense to me, since a buildcontext should be different for different artifacts (different bucket to pull from, etc).

This PR updates the config to v1beta8 as it represents a breaking change to the skaffold config.

I also added an integration test to make sure kaniko can build multiple artifacts.

This refactor will ultimately make it much easier to implement #1549

Priya Wadhwa added 4 commits March 13, 2019 11:51
so that other artifacts can use the function.
This commit removes the KanikoBuild type, which is confusing as it
reprseents both a builder and an environment. It also assumes that
certain elements (buildcontext) apply to all artifacts, when in reality
different artifacts should have different buildcontext.

KanikoBuild is replaced with a KanikoArtifact type, which can be
specified per artifact. I also added a ClusterDetails field to contain
info about the cluster itself (namespace, timeouts, secrets etc)
args = append(args, docker.GetBuildArgs(artifact.DockerArtifact)...)

// TODO: remove since AdditionalFlags will be deprecated (priyawadhwa@)
args = append(args, kanikoArtifact.AdditionalFlags...)
Copy link
Contributor

Choose a reason for hiding this comment

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

let's put out a deprecation warning here into the log if AdditionalFlags are not empty?

if err := withClusterConfig(c,
setDefaultClusterNamespace,
setDefaultClusterTimeout,
setDefaultClusterSecret,
Copy link
Contributor

@balopat balopat Mar 15, 2019

Choose a reason for hiding this comment

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

How about

Suggested change
setDefaultClusterSecret,
setDefaultClusterPullSecret,

?

Copy link
Contributor

@balopat balopat left a comment

Choose a reason for hiding this comment

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

LGTM with some nits

@codecov-io
Copy link

Codecov Report

Merging #1797 into master will increase coverage by 0.21%.
The diff coverage is 42.6%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #1797      +/-   ##
=========================================
+ Coverage   45.48%   45.7%   +0.21%     
=========================================
  Files         142     142              
  Lines        6617    6671      +54     
=========================================
+ Hits         3010    3049      +39     
- Misses       3306    3316      +10     
- Partials      301     306       +5
Impacted Files Coverage Δ
pkg/skaffold/plugin/environments/gcb/types.go 0% <0%> (ø) ⬆️
pkg/skaffold/build/local/local.go 33.33% <0%> (ø) ⬆️
pkg/skaffold/plugin/builders/docker/builder.go 14.58% <0%> (ø) ⬆️
pkg/skaffold/runner/runner.go 60.09% <0%> (ø) ⬆️
pkg/skaffold/build/kaniko/types.go 0% <0%> (ø) ⬆️
pkg/skaffold/docker/parse.go 75.11% <100%> (ø) ⬆️
pkg/skaffold/docker/context.go 80% <100%> (ø) ⬆️
pkg/skaffold/schema/defaults/defaults.go 35.4% <18%> (-2.26%) ⬇️
pkg/skaffold/schema/v1beta6/upgrade.go 56.75% <50%> (-6.88%) ⬇️
pkg/skaffold/build/kaniko/run.go 38.23% <78.78%> (+38.23%) ⬆️
... and 1 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 f58be2a...72c0e42. Read the comment docs.

1 similar comment
@codecov-io
Copy link

Codecov Report

Merging #1797 into master will increase coverage by 0.21%.
The diff coverage is 42.6%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #1797      +/-   ##
=========================================
+ Coverage   45.48%   45.7%   +0.21%     
=========================================
  Files         142     142              
  Lines        6617    6671      +54     
=========================================
+ Hits         3010    3049      +39     
- Misses       3306    3316      +10     
- Partials      301     306       +5
Impacted Files Coverage Δ
pkg/skaffold/plugin/environments/gcb/types.go 0% <0%> (ø) ⬆️
pkg/skaffold/build/local/local.go 33.33% <0%> (ø) ⬆️
pkg/skaffold/plugin/builders/docker/builder.go 14.58% <0%> (ø) ⬆️
pkg/skaffold/runner/runner.go 60.09% <0%> (ø) ⬆️
pkg/skaffold/build/kaniko/types.go 0% <0%> (ø) ⬆️
pkg/skaffold/docker/parse.go 75.11% <100%> (ø) ⬆️
pkg/skaffold/docker/context.go 80% <100%> (ø) ⬆️
pkg/skaffold/schema/defaults/defaults.go 35.4% <18%> (-2.26%) ⬇️
pkg/skaffold/schema/v1beta6/upgrade.go 56.75% <50%> (-6.88%) ⬇️
pkg/skaffold/build/kaniko/run.go 38.23% <78.78%> (+38.23%) ⬆️
... and 1 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 f58be2a...72c0e42. Read the comment docs.

@priyawadhwa
Copy link
Contributor Author

Ran into #1767 here, rerunning kokoro

@dgageot
Copy link
Contributor

dgageot commented Mar 15, 2019

@priyawadhwa you might want to rebase on top of master instead, you'll get improvements to the integration tests

@priyawadhwa
Copy link
Contributor Author

Thanks for the tip @dgageot !

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.

None yet

5 participants