Skip to content

Commit

Permalink
Merge pull request #1387 from priyawadhwa/kaniko-flags
Browse files Browse the repository at this point in the history
Add additional flags to kaniko builder
  • Loading branch information
dgageot authored Dec 11, 2018
2 parents 19097cf + 7bc16cf commit cf1578a
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 9 deletions.
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

0 comments on commit cf1578a

Please sign in to comment.