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

Add additional flags to kaniko builder #1387

Merged
merged 1 commit into from
Dec 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions integration/examples/annotated-skaffold.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,17 @@ build:
# A cache repo can be specified to store cached layers, otherwise one will be inferred
# from the image name. See https://github.com/GoogleContainerTools/kaniko#caching
#
# Additional flags can be specified as a list. To see all additional flags, visit:
# https://github.com/GoogleContainerTools/kaniko#additional-flags
#
# kaniko:
# buildContext:
# gcsBucket: k8s-skaffold
# localDir: {}
# cache:
# repo: gcr.io/my-project/skaffold/cache
# flags:
# - --aditional-flag
# pullSecret: /a/secret/path/serviceaccount.json
# pullSecretName: kaniko-secret
# namespace: default
Expand Down
2 changes: 2 additions & 0 deletions integration/examples/kaniko-local/skaffold.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ build:
pullSecretName: e2esecret
namespace: default
cache: {}
flags:
- --single-snapshot
deploy:
kubectl:
manifests:
Expand Down
4 changes: 2 additions & 2 deletions pkg/skaffold/build/kaniko/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ func (b *Builder) run(ctx context.Context, out io.Writer, artifact *latest.Artif
fmt.Sprintf("--dockerfile=%s", artifact.DockerArtifact.DockerfilePath),
fmt.Sprintf("--context=%s", context),
fmt.Sprintf("--destination=%s", imageDst),
fmt.Sprintf("-v=%s", logLevel().String()),
}
fmt.Sprintf("-v=%s", logLevel().String())}
args = append(args, cfg.AdditionalFlags...)
args = append(args, docker.GetBuildArgs(artifact.DockerArtifact)...)

if cfg.Cache != nil {
Expand Down
15 changes: 8 additions & 7 deletions pkg/skaffold/schema/latest/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,14 @@ type KanikoCache struct {
// KanikoBuild contains the fields needed to do a on-cluster build using
// the kaniko image
type KanikoBuild struct {
BuildContext *KanikoBuildContext `yaml:"buildContext,omitempty"`
Cache *KanikoCache `yaml:"cache,omitempty"`
PullSecret string `yaml:"pullSecret,omitempty"`
PullSecretName string `yaml:"pullSecretName,omitempty"`
Namespace string `yaml:"namespace,omitempty"`
Timeout string `yaml:"timeout,omitempty"`
Image string `yaml:"image,omitempty"`
BuildContext *KanikoBuildContext `yaml:"buildContext,omitempty"`
Cache *KanikoCache `yaml:"cache,omitempty"`
AdditionalFlags []string `yaml:"flags,omitempty"`
PullSecret string `yaml:"pullSecret,omitempty"`
PullSecretName string `yaml:"pullSecretName,omitempty"`
Namespace string `yaml:"namespace,omitempty"`
Timeout string `yaml:"timeout,omitempty"`
Image string `yaml:"image,omitempty"`
}

type TestConfig []*TestCase
Expand Down