github.com/GoogleContainerTools/skaffold@v1.39.18/pkg/skaffold/schema/v2beta10/config.go (about) 1 /* 2 Copyright 2019 The Skaffold Authors 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 17 package v2beta10 18 19 import ( 20 v1 "k8s.io/api/core/v1" 21 22 "github.com/GoogleContainerTools/skaffold/pkg/skaffold/schema/util" 23 ) 24 25 // !!! WARNING !!! This config version is already released, please DO NOT MODIFY the structs in this file. 26 const Version string = "skaffold/v2beta10" 27 28 // NewSkaffoldConfig creates a SkaffoldConfig 29 func NewSkaffoldConfig() util.VersionedConfig { 30 return new(SkaffoldConfig) 31 } 32 33 // SkaffoldConfig holds the fields parsed from the Skaffold configuration file (skaffold.yaml). 34 type SkaffoldConfig struct { 35 // APIVersion is the version of the configuration. 36 APIVersion string `yaml:"apiVersion" yamltags:"required"` 37 38 // Kind is always `Config`. Defaults to `Config`. 39 Kind string `yaml:"kind" yamltags:"required"` 40 41 // Metadata holds additional information about the config. 42 Metadata Metadata `yaml:"metadata,omitempty"` 43 44 // Pipeline defines the Build/Test/Deploy phases. 45 Pipeline `yaml:",inline"` 46 47 // Profiles *beta* can override be used to `build`, `test` or `deploy` configuration. 48 Profiles []Profile `yaml:"profiles,omitempty"` 49 } 50 51 // Metadata holds an optional name of the project. 52 type Metadata struct { 53 // Name is an identifier for the project. 54 Name string `yaml:"name,omitempty"` 55 } 56 57 // Pipeline describes a Skaffold pipeline. 58 type Pipeline struct { 59 // Build describes how images are built. 60 Build BuildConfig `yaml:"build,omitempty"` 61 62 // Test describes how images are tested. 63 Test []*TestCase `yaml:"test,omitempty"` 64 65 // Deploy describes how images are deployed. 66 Deploy DeployConfig `yaml:"deploy,omitempty"` 67 68 // PortForward describes user defined resources to port-forward. 69 PortForward []*PortForwardResource `yaml:"portForward,omitempty"` 70 } 71 72 func (c *SkaffoldConfig) GetVersion() string { 73 return c.APIVersion 74 } 75 76 // ResourceType describes the Kubernetes resource types used for port forwarding. 77 type ResourceType string 78 79 // PortForwardResource describes a resource to port forward. 80 type PortForwardResource struct { 81 // Type is the Kubernetes type that should be port forwarded. 82 // Acceptable resource types include: `Service`, `Pod` and Controller resource type that has a pod spec: `ReplicaSet`, `ReplicationController`, `Deployment`, `StatefulSet`, `DaemonSet`, `Job`, `CronJob`. 83 Type ResourceType `yaml:"resourceType,omitempty"` 84 85 // Name is the name of the Kubernetes resource to port forward. 86 Name string `yaml:"resourceName,omitempty"` 87 88 // Namespace is the namespace of the resource to port forward. 89 Namespace string `yaml:"namespace,omitempty"` 90 91 // Port is the resource port that will be forwarded. 92 Port util.IntOrString `yaml:"port,omitempty"` 93 94 // Address is the local address to bind to. Defaults to the loopback address 127.0.0.1. 95 Address string `yaml:"address,omitempty"` 96 97 // LocalPort is the local port to forward to. If the port is unavailable, Skaffold will choose a random open port to forward to. *Optional*. 98 LocalPort int `yaml:"localPort,omitempty"` 99 } 100 101 // BuildConfig contains all the configuration for the build steps. 102 type BuildConfig struct { 103 // Artifacts lists the images you're going to be building. 104 Artifacts []*Artifact `yaml:"artifacts,omitempty"` 105 106 // InsecureRegistries is a list of registries declared by the user to be insecure. 107 // These registries will be connected to via HTTP instead of HTTPS. 108 InsecureRegistries []string `yaml:"insecureRegistries,omitempty"` 109 110 // TagPolicy *beta* determines how images are tagged. 111 // A few strategies are provided here, although you most likely won't need to care! 112 // If not specified, it defaults to `gitCommit: {variant: Tags}`. 113 TagPolicy TagPolicy `yaml:"tagPolicy,omitempty"` 114 115 BuildType `yaml:",inline"` 116 } 117 118 // TagPolicy contains all the configuration for the tagging step. 119 type TagPolicy struct { 120 // GitTagger *beta* tags images with the git tag or commit of the artifact's workspace. 121 GitTagger *GitTagger `yaml:"gitCommit,omitempty" yamltags:"oneOf=tag"` 122 123 // ShaTagger *beta* tags images with their sha256 digest. 124 ShaTagger *ShaTagger `yaml:"sha256,omitempty" yamltags:"oneOf=tag"` 125 126 // EnvTemplateTagger *beta* tags images with a configurable template string. 127 EnvTemplateTagger *EnvTemplateTagger `yaml:"envTemplate,omitempty" yamltags:"oneOf=tag"` 128 129 // DateTimeTagger *beta* tags images with the build timestamp. 130 DateTimeTagger *DateTimeTagger `yaml:"dateTime,omitempty" yamltags:"oneOf=tag"` 131 132 // CustomTemplateTagger *beta* tags images with a configurable template string *composed of other taggers*. 133 CustomTemplateTagger *CustomTemplateTagger `yaml:"customTemplate,omitempty" yamltags:"oneOf=tag"` 134 } 135 136 // ShaTagger *beta* tags images with their sha256 digest. 137 type ShaTagger struct{} 138 139 // GitTagger *beta* tags images with the git tag or commit of the artifact's workspace. 140 type GitTagger struct { 141 // Variant determines the behavior of the git tagger. Valid variants are: 142 // `Tags` (default): use git tags or fall back to abbreviated commit hash. 143 // `CommitSha`: use the full git commit sha. 144 // `AbbrevCommitSha`: use the abbreviated git commit sha. 145 // `TreeSha`: use the full tree hash of the artifact workingdir. 146 // `AbbrevTreeSha`: use the abbreviated tree hash of the artifact workingdir. 147 Variant string `yaml:"variant,omitempty"` 148 149 // Prefix adds a fixed prefix to the tag. 150 Prefix string `yaml:"prefix,omitempty"` 151 } 152 153 // EnvTemplateTagger *beta* tags images with a configurable template string. 154 type EnvTemplateTagger struct { 155 // Template used to produce the image name and tag. 156 // See golang [text/template](https://golang.org/pkg/text/template/). 157 // The template is executed against the current environment, 158 // with those variables injected. 159 // For example: `{{.RELEASE}}`. 160 Template string `yaml:"template,omitempty" yamltags:"required"` 161 } 162 163 // DateTimeTagger *beta* tags images with the build timestamp. 164 type DateTimeTagger struct { 165 // Format formats the date and time. 166 // See [#Time.Format](https://golang.org/pkg/time/#Time.Format). 167 // Defaults to `2006-01-02_15-04-05.999_MST`. 168 Format string `yaml:"format,omitempty"` 169 170 // TimeZone sets the timezone for the date and time. 171 // See [Time.LoadLocation](https://golang.org/pkg/time/#Time.LoadLocation). 172 // Defaults to the local timezone. 173 TimeZone string `yaml:"timezone,omitempty"` 174 } 175 176 // CustomTemplateTagger *beta* tags images with a configurable template string. 177 type CustomTemplateTagger struct { 178 // Template used to produce the image name and tag. 179 // See golang [text/template](https://golang.org/pkg/text/template/). 180 // The template is executed against the provided components with those variables injected. 181 // For example: `{{.DATE}}` where DATE references a TaggerComponent. 182 Template string `yaml:"template,omitempty" yamltags:"required"` 183 184 // Components lists TaggerComponents that the template (see field above) can be executed against. 185 Components []TaggerComponent `yaml:"components,omitempty"` 186 } 187 188 // TaggerComponent *beta* is a component of CustomTemplateTagger. 189 type TaggerComponent struct { 190 // Name is an identifier for the component. 191 Name string `yaml:"name,omitempty"` 192 193 // Component is a tagging strategy to be used in CustomTemplateTagger. 194 Component TagPolicy `yaml:",inline" yamltags:"skipTrim"` 195 } 196 197 // BuildType contains the specific implementation and parameters needed 198 // for the build step. Only one field should be populated. 199 type BuildType struct { 200 // LocalBuild *beta* describes how to do a build on the local docker daemon 201 // and optionally push to a repository. 202 LocalBuild *LocalBuild `yaml:"local,omitempty" yamltags:"oneOf=build"` 203 204 // GoogleCloudBuild *beta* describes how to do a remote build on 205 // [Google Cloud Build](https://cloud.google.com/cloud-build/). 206 GoogleCloudBuild *GoogleCloudBuild `yaml:"googleCloudBuild,omitempty" yamltags:"oneOf=build"` 207 208 // Cluster *beta* describes how to do an on-cluster build. 209 Cluster *ClusterDetails `yaml:"cluster,omitempty" yamltags:"oneOf=build"` 210 } 211 212 // LocalBuild *beta* describes how to do a build on the local docker daemon 213 // and optionally push to a repository. 214 type LocalBuild struct { 215 // Push should images be pushed to a registry. 216 // If not specified, images are pushed only if the current Kubernetes context 217 // connects to a remote cluster. 218 Push *bool `yaml:"push,omitempty"` 219 220 // TryImportMissing whether to attempt to import artifacts from 221 // Docker (either a local or remote registry) if not in the cache. 222 TryImportMissing bool `yaml:"tryImportMissing,omitempty"` 223 224 // UseDockerCLI use `docker` command-line interface instead of Docker Engine APIs. 225 UseDockerCLI bool `yaml:"useDockerCLI,omitempty"` 226 227 // UseBuildkit use BuildKit to build Docker images. If unspecified, uses the Docker default. 228 UseBuildkit *bool `yaml:"useBuildkit,omitempty"` 229 230 // Concurrency is how many artifacts can be built concurrently. 0 means "no-limit". 231 // Defaults to `1`. 232 Concurrency *int `yaml:"concurrency,omitempty"` 233 } 234 235 // GoogleCloudBuild *beta* describes how to do a remote build on 236 // [Google Cloud Build](https://cloud.google.com/cloud-build/docs/). 237 // Docker and Jib artifacts can be built on Cloud Build. The `projectId` needs 238 // to be provided and the currently logged in user should be given permissions to trigger 239 // new builds. 240 type GoogleCloudBuild struct { 241 // ProjectID is the ID of your Cloud Platform Project. 242 // If it is not provided, Skaffold will guess it from the image name. 243 // For example, given the artifact image name `gcr.io/myproject/image`, Skaffold 244 // will use the `myproject` GCP project. 245 ProjectID string `yaml:"projectId,omitempty"` 246 247 // DiskSizeGb is the disk size of the VM that runs the build. 248 // See [Cloud Build Reference](https://cloud.google.com/cloud-build/docs/api/reference/rest/v1/projects.builds#buildoptions). 249 DiskSizeGb int64 `yaml:"diskSizeGb,omitempty"` 250 251 // MachineType is the type of the VM that runs the build. 252 // See [Cloud Build Reference](https://cloud.google.com/cloud-build/docs/api/reference/rest/v1/projects.builds#buildoptions). 253 MachineType string `yaml:"machineType,omitempty"` 254 255 // Timeout is the amount of time (in seconds) that this build should be allowed to run. 256 // See [Cloud Build Reference](https://cloud.google.com/cloud-build/docs/api/reference/rest/v1/projects.builds#resource-build). 257 Timeout string `yaml:"timeout,omitempty"` 258 259 // Logging specifies the logging mode. 260 // Valid modes are: 261 // `LOGGING_UNSPECIFIED`: The service determines the logging mode. 262 // `LEGACY`: Stackdriver logging and Cloud Storage logging are enabled (default). 263 // `GCS_ONLY`: Only Cloud Storage logging is enabled. 264 // See [Cloud Build Reference](https://cloud.google.com/cloud-build/docs/api/reference/rest/v1/projects.builds#loggingmode). 265 Logging string `yaml:"logging,omitempty"` 266 267 // LogStreamingOption specifies the behavior when writing build logs to Google Cloud Storage. 268 // Valid options are: 269 // `STREAM_DEFAULT`: Service may automatically determine build log streaming behavior. 270 // `STREAM_ON`: Build logs should be streamed to Google Cloud Storage. 271 // `STREAM_OFF`: Build logs should not be streamed to Google Cloud Storage; they will be written when the build is completed. 272 // See [Cloud Build Reference](https://cloud.google.com/cloud-build/docs/api/reference/rest/v1/projects.builds#logstreamingoption). 273 LogStreamingOption string `yaml:"logStreamingOption,omitempty"` 274 275 // DockerImage is the image that runs a Docker build. 276 // See [Cloud Builders](https://cloud.google.com/cloud-build/docs/cloud-builders). 277 // Defaults to `gcr.io/cloud-builders/docker`. 278 DockerImage string `yaml:"dockerImage,omitempty"` 279 280 // KanikoImage is the image that runs a Kaniko build. 281 // See [Cloud Builders](https://cloud.google.com/cloud-build/docs/cloud-builders). 282 // Defaults to `gcr.io/kaniko-project/executor`. 283 KanikoImage string `yaml:"kanikoImage,omitempty"` 284 285 // MavenImage is the image that runs a Maven build. 286 // See [Cloud Builders](https://cloud.google.com/cloud-build/docs/cloud-builders). 287 // Defaults to `gcr.io/cloud-builders/mvn`. 288 MavenImage string `yaml:"mavenImage,omitempty"` 289 290 // GradleImage is the image that runs a Gradle build. 291 // See [Cloud Builders](https://cloud.google.com/cloud-build/docs/cloud-builders). 292 // Defaults to `gcr.io/cloud-builders/gradle`. 293 GradleImage string `yaml:"gradleImage,omitempty"` 294 295 // PackImage is the image that runs a Cloud Native Buildpacks build. 296 // See [Cloud Builders](https://cloud.google.com/cloud-build/docs/cloud-builders). 297 // Defaults to `gcr.io/k8s-skaffold/pack`. 298 PackImage string `yaml:"packImage,omitempty"` 299 300 // Concurrency is how many artifacts can be built concurrently. 0 means "no-limit". 301 // Defaults to `0`. 302 Concurrency int `yaml:"concurrency,omitempty"` 303 304 // WorkerPool configures a pool of workers to run the build. 305 WorkerPool string `yaml:"workerPool,omitempty"` 306 } 307 308 // KanikoCache configures Kaniko caching. If a cache is specified, Kaniko will 309 // use a remote cache which will speed up builds. 310 type KanikoCache struct { 311 // Repo is a remote repository to store cached layers. If none is specified, one will be 312 // inferred from the image name. See [Kaniko Caching](https://github.com/GoogleContainerTools/kaniko#caching). 313 Repo string `yaml:"repo,omitempty"` 314 // HostPath specifies a path on the host that is mounted to each pod as read only cache volume containing base images. 315 // If set, must exist on each node and prepopulated with kaniko-warmer. 316 HostPath string `yaml:"hostPath,omitempty"` 317 // TTL Cache timeout in hours. 318 TTL string `yaml:"ttl,omitempty"` 319 } 320 321 // ClusterDetails *beta* describes how to do an on-cluster build. 322 type ClusterDetails struct { 323 // HTTPProxy for kaniko pod. 324 HTTPProxy string `yaml:"HTTP_PROXY,omitempty"` 325 326 // HTTPSProxy for kaniko pod. 327 HTTPSProxy string `yaml:"HTTPS_PROXY,omitempty"` 328 329 // PullSecretPath is the path to the Google Cloud service account secret key file. 330 PullSecretPath string `yaml:"pullSecretPath,omitempty"` 331 332 // PullSecretName is the name of the Kubernetes secret for pulling base images 333 // and pushing the final image. If given, the secret needs to contain the Google Cloud 334 // service account secret key under the key `kaniko-secret`. 335 // Defaults to `kaniko-secret`. 336 PullSecretName string `yaml:"pullSecretName,omitempty"` 337 338 // PullSecretMountPath is the path the pull secret will be mounted at within the running container. 339 PullSecretMountPath string `yaml:"pullSecretMountPath,omitempty"` 340 341 // Namespace is the Kubernetes namespace. 342 // Defaults to current namespace in Kubernetes configuration. 343 Namespace string `yaml:"namespace,omitempty"` 344 345 // Timeout is the amount of time (in seconds) that this build is allowed to run. 346 // Defaults to 20 minutes (`20m`). 347 Timeout string `yaml:"timeout,omitempty"` 348 349 // DockerConfig describes how to mount the local Docker configuration into a pod. 350 DockerConfig *DockerConfig `yaml:"dockerConfig,omitempty"` 351 352 // ServiceAccountName describes the Kubernetes service account to use for the pod. 353 // Defaults to 'default'. 354 ServiceAccountName string `yaml:"serviceAccount,omitempty"` 355 356 // Tolerations describes the Kubernetes tolerations for the pod. 357 Tolerations []v1.Toleration `yaml:"tolerations,omitempty"` 358 359 // Annotations describes the Kubernetes annotations for the pod. 360 Annotations map[string]string `yaml:"annotations,omitempty"` 361 362 // RunAsUser defines the UID to request for running the container. 363 // If omitted, no SecurityContext will be specified for the pod and will therefore be inherited 364 // from the service account. 365 RunAsUser *int64 `yaml:"runAsUser,omitempty"` 366 367 // Resources define the resource requirements for the kaniko pod. 368 Resources *ResourceRequirements `yaml:"resources,omitempty"` 369 370 // Concurrency is how many artifacts can be built concurrently. 0 means "no-limit". 371 // Defaults to `0`. 372 Concurrency int `yaml:"concurrency,omitempty"` 373 374 // Volumes defines container mounts for ConfigMap and Secret resources. 375 Volumes []v1.Volume `yaml:"volumes,omitempty"` 376 377 // RandomPullSecret adds a random UUID postfix to the default name of the pull secret to facilitate parallel builds, e.g. kaniko-secretdocker-cfgfd154022-c761-416f-8eb3-cf8258450b85. 378 RandomPullSecret bool `yaml:"randomPullSecret,omitempty"` 379 380 // RandomDockerConfigSecret adds a random UUID postfix to the default name of the docker secret to facilitate parallel builds, e.g. docker-cfgfd154022-c761-416f-8eb3-cf8258450b85. 381 RandomDockerConfigSecret bool `yaml:"randomDockerConfigSecret,omitempty"` 382 } 383 384 // DockerConfig contains information about the docker `config.json` to mount. 385 type DockerConfig struct { 386 // Path is the path to the docker `config.json`. 387 Path string `yaml:"path,omitempty"` 388 389 // SecretName is the Kubernetes secret that contains the `config.json` Docker configuration. 390 // Note that the expected secret type is not 'kubernetes.io/dockerconfigjson' but 'Opaque'. 391 SecretName string `yaml:"secretName,omitempty"` 392 } 393 394 // ResourceRequirements describes the resource requirements for the kaniko pod. 395 type ResourceRequirements struct { 396 // Requests [resource requests](https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/#resource-requests-and-limits-of-pod-and-container) for the Kaniko pod. 397 Requests *ResourceRequirement `yaml:"requests,omitempty"` 398 399 // Limits [resource limits](https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/#resource-requests-and-limits-of-pod-and-container) for the Kaniko pod. 400 Limits *ResourceRequirement `yaml:"limits,omitempty"` 401 } 402 403 // ResourceRequirement stores the CPU/Memory requirements for the pod. 404 type ResourceRequirement struct { 405 // CPU the number cores to be used. 406 // For example: `2`, `2.0` or `200m`. 407 CPU string `yaml:"cpu,omitempty"` 408 409 // Memory the amount of memory to allocate to the pod. 410 // For example: `1Gi` or `1000Mi`. 411 Memory string `yaml:"memory,omitempty"` 412 413 // EphemeralStorage the amount of Ephemeral storage to allocate to the pod. 414 // For example: `1Gi` or `1000Mi`. 415 EphemeralStorage string `yaml:"ephemeralStorage,omitempty"` 416 417 // ResourceStorage the amount of resource storage to allocate to the pod. 418 // For example: `1Gi` or `1000Mi`. 419 ResourceStorage string `yaml:"resourceStorage,omitempty"` 420 } 421 422 // TestCase is a list of structure tests to run on images that Skaffold builds. 423 type TestCase struct { 424 // ImageName is the artifact on which to run those tests. 425 // For example: `gcr.io/k8s-skaffold/example`. 426 ImageName string `yaml:"image" yamltags:"required"` 427 428 // StructureTests lists the [Container Structure Tests](https://github.com/GoogleContainerTools/container-structure-test) 429 // to run on that artifact. 430 // For example: `["./test/*"]`. 431 StructureTests []string `yaml:"structureTests,omitempty"` 432 } 433 434 // DeployConfig contains all the configuration needed by the deploy steps. 435 type DeployConfig struct { 436 DeployType `yaml:",inline"` 437 438 // StatusCheckDeadlineSeconds *beta* is the deadline for deployments to stabilize in seconds. 439 StatusCheckDeadlineSeconds int `yaml:"statusCheckDeadlineSeconds,omitempty"` 440 441 // KubeContext is the Kubernetes context that Skaffold should deploy to. 442 // For example: `minikube`. 443 KubeContext string `yaml:"kubeContext,omitempty"` 444 445 // Logs configures how container logs are printed as a result of a deployment. 446 Logs LogsConfig `yaml:"logs,omitempty"` 447 } 448 449 // DeployType contains the specific implementation and parameters needed 450 // for the deploy step. All three deployer types can be used at the same 451 // time for hybrid workflows. 452 type DeployType struct { 453 // HelmDeploy *beta* uses the `helm` CLI to apply the charts to the cluster. 454 HelmDeploy *HelmDeploy `yaml:"helm,omitempty"` 455 456 // KptDeploy *alpha* uses the `kpt` CLI to manage and deploy manifests. 457 KptDeploy *KptDeploy `yaml:"kpt,omitempty"` 458 459 // KubectlDeploy *beta* uses a client side `kubectl apply` to deploy manifests. 460 // You'll need a `kubectl` CLI version installed that's compatible with your cluster. 461 KubectlDeploy *KubectlDeploy `yaml:"kubectl,omitempty"` 462 463 // KustomizeDeploy *beta* uses the `kustomize` CLI to "patch" a deployment for a target environment. 464 KustomizeDeploy *KustomizeDeploy `yaml:"kustomize,omitempty"` 465 } 466 467 // KubectlDeploy *beta* uses a client side `kubectl apply` to deploy manifests. 468 // You'll need a `kubectl` CLI version installed that's compatible with your cluster. 469 type KubectlDeploy struct { 470 // Manifests lists the Kubernetes yaml or json manifests. 471 // Defaults to `["k8s/*.yaml"]`. 472 Manifests []string `yaml:"manifests,omitempty"` 473 474 // RemoteManifests lists Kubernetes manifests in remote clusters. 475 RemoteManifests []string `yaml:"remoteManifests,omitempty"` 476 477 // Flags are additional flags passed to `kubectl`. 478 Flags KubectlFlags `yaml:"flags,omitempty"` 479 480 // DefaultNamespace is the default namespace passed to kubectl on deployment if no other override is given. 481 DefaultNamespace *string `yaml:"defaultNamespace,omitempty"` 482 } 483 484 // KubectlFlags are additional flags passed on the command 485 // line to kubectl either on every command (Global), on creations (Apply) 486 // or deletions (Delete). 487 type KubectlFlags struct { 488 // Global are additional flags passed on every command. 489 Global []string `yaml:"global,omitempty"` 490 491 // Apply are additional flags passed on creations (`kubectl apply`). 492 Apply []string `yaml:"apply,omitempty"` 493 494 // Delete are additional flags passed on deletions (`kubectl delete`). 495 Delete []string `yaml:"delete,omitempty"` 496 497 // DisableValidation passes the `--validate=false` flag to supported 498 // `kubectl` commands when enabled. 499 DisableValidation bool `yaml:"disableValidation,omitempty"` 500 } 501 502 // HelmDeploy *beta* uses the `helm` CLI to apply the charts to the cluster. 503 type HelmDeploy struct { 504 // Releases is a list of Helm releases. 505 Releases []HelmRelease `yaml:"releases,omitempty" yamltags:"required"` 506 507 // Flags are additional option flags that are passed on the command 508 // line to `helm`. 509 Flags HelmDeployFlags `yaml:"flags,omitempty"` 510 } 511 512 // HelmDeployFlags are additional option flags that are passed on the command 513 // line to `helm`. 514 type HelmDeployFlags struct { 515 // Global are additional flags passed on every command. 516 Global []string `yaml:"global,omitempty"` 517 518 // Install are additional flags passed to (`helm install`). 519 Install []string `yaml:"install,omitempty"` 520 521 // Upgrade are additional flags passed to (`helm upgrade`). 522 Upgrade []string `yaml:"upgrade,omitempty"` 523 } 524 525 // KustomizeDeploy *beta* uses the `kustomize` CLI to "patch" a deployment for a target environment. 526 type KustomizeDeploy struct { 527 // KustomizePaths is the path to Kustomization files. 528 // Defaults to `["."]`. 529 KustomizePaths []string `yaml:"paths,omitempty"` 530 531 // Flags are additional flags passed to `kubectl`. 532 Flags KubectlFlags `yaml:"flags,omitempty"` 533 534 // BuildArgs are additional args passed to `kustomize build`. 535 BuildArgs []string `yaml:"buildArgs,omitempty"` 536 537 // DefaultNamespace is the default namespace passed to kubectl on deployment if no other override is given. 538 DefaultNamespace *string `yaml:"defaultNamespace,omitempty"` 539 } 540 541 // KptDeploy *alpha* uses the `kpt` CLI to manage and deploy manifests. 542 type KptDeploy struct { 543 // Dir is the path to the config directory (Required). 544 // By default, the Dir contains the application configurations, 545 // [kustomize config files](https://kubectl.docs.kubernetes.io/pages/examples/kustomize.html) 546 // and [declarative kpt functions](https://googlecontainertools.github.io/kpt/guides/consumer/function/#declarative-run). 547 Dir string `yaml:"dir" yamltags:"required"` 548 549 // Fn adds additional configurations for `kpt fn`. 550 Fn KptFn `yaml:"fn,omitempty"` 551 552 // Live adds additional configurations for `kpt live`. 553 Live KptLive `yaml:"live,omitempty"` 554 } 555 556 // KptFn adds additional configurations used when calling `kpt fn`. 557 type KptFn struct { 558 // FnPath is the directory to discover the declarative kpt functions. 559 // If not provided, kpt deployer uses `kpt.Dir`. 560 FnPath string `yaml:"fnPath,omitempty"` 561 562 // Image is a kpt function image to run the configs imperatively. If provided, kpt.fn.fnPath 563 // will be ignored. 564 Image string `yaml:"image,omitempty"` 565 566 // NetworkName is the docker network name to run the kpt function containers (default "bridge"). 567 NetworkName string `yaml:"networkName,omitempty"` 568 569 // GlobalScope sets the global scope for the kpt functions. see `kpt help fn run`. 570 GlobalScope bool `yaml:"globalScope,omitempty"` 571 572 // Network enables network access for the kpt function containers. 573 Network bool `yaml:"network,omitempty"` 574 575 // Mount is a list of storage options to mount to the fn image. 576 Mount []string `yaml:"mount,omitempty"` 577 578 // SinkDir is the directory to where the manipulated resource output is stored. 579 SinkDir string `yaml:"sinkDir,omitempty"` 580 } 581 582 // KptLive adds additional configurations used when calling `kpt live`. 583 type KptLive struct { 584 // Apply sets the kpt inventory directory. 585 Apply KptApplyInventory `yaml:"apply,omitempty"` 586 587 // Options adds additional configurations for `kpt live apply` commands. 588 Options KptApplyOptions `yaml:"options,omitempty"` 589 } 590 591 // KptApplyInventory sets the kpt inventory directory. 592 type KptApplyInventory struct { 593 // Dir is equivalent to the dir in `kpt live apply <dir>`. If not provided, 594 // kpt deployer will create a hidden directory `.kpt-hydrated` to store the manipulated 595 // resource output and the kpt inventory-template.yaml file. 596 Dir string `yaml:"dir,omitempty"` 597 598 // InventoryID *alpha* is the identifier for a group of applied resources. 599 // This value is only needed when the `kpt live` is working on a pre-applied cluster resources. 600 InventoryID string `yaml:"inventoryID,omitempty"` 601 602 // InventoryNamespace *alpha* sets the inventory namespace. 603 InventoryNamespace string `yaml:"inventoryNamespace,omitempty"` 604 } 605 606 // KptApplyOptions adds additional configurations used when calling `kpt live apply`. 607 type KptApplyOptions struct { 608 // PollPeriod sets for the polling period for resource statuses. Default to 2s. 609 PollPeriod string `yaml:"pollPeriod,omitempty"` 610 611 // PrunePropagationPolicy sets the propagation policy for pruning. 612 // Possible settings are Background, Foreground, Orphan. 613 // Default to "Background". 614 PrunePropagationPolicy string `yaml:"prunePropagationPolicy,omitempty"` 615 616 // PruneTimeout sets the time threshold to wait for all pruned resources to be deleted. 617 PruneTimeout string `yaml:"pruneTimeout,omitempty"` 618 619 // ReconcileTimeout sets the time threshold to wait for all resources to reach the current status. 620 ReconcileTimeout string `yaml:"reconcileTimeout,omitempty"` 621 } 622 623 // HelmRelease describes a helm release to be deployed. 624 type HelmRelease struct { 625 // Name is the name of the Helm release. 626 Name string `yaml:"name,omitempty" yamltags:"required"` 627 628 // ChartPath is the path to the Helm chart. 629 ChartPath string `yaml:"chartPath,omitempty" yamltags:"required"` 630 631 // ValuesFiles are the paths to the Helm `values` files. 632 ValuesFiles []string `yaml:"valuesFiles,omitempty"` 633 634 // ArtifactOverrides are key value pairs where the 635 // key represents the parameter used in the `--set-string` Helm CLI flag to define a container 636 // image and the value corresponds to artifact i.e. `ImageName` defined in `Build.Artifacts` section. 637 // The resulting command-line is controlled by `ImageStrategy`. 638 ArtifactOverrides util.FlatMap `yaml:"artifactOverrides,omitempty"` 639 640 // Namespace is the Kubernetes namespace. 641 Namespace string `yaml:"namespace,omitempty"` 642 643 // Version is the version of the chart. 644 Version string `yaml:"version,omitempty"` 645 646 // SetValues are key-value pairs. 647 // If present, Skaffold will send `--set` flag to Helm CLI and append all pairs after the flag. 648 SetValues util.FlatMap `yaml:"setValues,omitempty"` 649 650 // SetValueTemplates are key-value pairs. 651 // If present, Skaffold will try to parse the value part of each key-value pair using 652 // environment variables in the system, then send `--set` flag to Helm CLI and append 653 // all parsed pairs after the flag. 654 SetValueTemplates util.FlatMap `yaml:"setValueTemplates,omitempty"` 655 656 // SetFiles are key-value pairs. 657 // If present, Skaffold will send `--set-file` flag to Helm CLI and append all pairs after the flag. 658 SetFiles map[string]string `yaml:"setFiles,omitempty"` 659 660 // CreateNamespace if `true`, Skaffold will send `--create-namespace` flag to Helm CLI. 661 // `--create-namespace` flag is available in Helm since version 3.2. 662 // Defaults is `false`. 663 CreateNamespace *bool `yaml:"createNamespace,omitempty"` 664 665 // Wait if `true`, Skaffold will send `--wait` flag to Helm CLI. 666 // Defaults to `false`. 667 Wait bool `yaml:"wait,omitempty"` 668 669 // RecreatePods if `true`, Skaffold will send `--recreate-pods` flag to Helm CLI 670 // when upgrading a new version of a chart in subsequent dev loop deploy. 671 // Defaults to `false`. 672 RecreatePods bool `yaml:"recreatePods,omitempty"` 673 674 // SkipBuildDependencies should build dependencies be skipped. 675 // Ignored when `remote: true`. 676 SkipBuildDependencies bool `yaml:"skipBuildDependencies,omitempty"` 677 678 // UseHelmSecrets instructs skaffold to use secrets plugin on deployment. 679 UseHelmSecrets bool `yaml:"useHelmSecrets,omitempty"` 680 681 // Remote specifies whether the chart path is remote, or exists on the host filesystem. 682 Remote bool `yaml:"remote,omitempty"` 683 684 // UpgradeOnChange specifies whether to upgrade helm chart on code changes. 685 // Default is `true` when helm chart is local (`remote: false`). 686 // Default is `false` if `remote: true`. 687 UpgradeOnChange *bool `yaml:"upgradeOnChange,omitempty"` 688 689 // Overrides are key-value pairs. 690 // If present, Skaffold will build a Helm `values` file that overrides 691 // the original and use it to call Helm CLI (`--f` flag). 692 Overrides util.HelmOverrides `yaml:"overrides,omitempty"` 693 694 // Packaged parameters for packaging helm chart (`helm package`). 695 Packaged *HelmPackaged `yaml:"packaged,omitempty"` 696 697 // ImageStrategy controls how an `ArtifactOverrides` entry is 698 // turned into `--set-string` Helm CLI flag or flags. 699 ImageStrategy HelmImageStrategy `yaml:"imageStrategy,omitempty"` 700 } 701 702 // HelmPackaged parameters for packaging helm chart (`helm package`). 703 type HelmPackaged struct { 704 // Version sets the `version` on the chart to this semver version. 705 Version string `yaml:"version,omitempty"` 706 707 // AppVersion sets the `appVersion` on the chart to this version. 708 AppVersion string `yaml:"appVersion,omitempty"` 709 } 710 711 // HelmImageStrategy adds image configurations to the Helm `values` file. 712 type HelmImageStrategy struct { 713 HelmImageConfig `yaml:",inline"` 714 } 715 716 // HelmImageConfig describes an image configuration. 717 type HelmImageConfig struct { 718 // HelmFQNConfig is the image configuration uses the syntax `IMAGE-NAME=IMAGE-REPOSITORY:IMAGE-TAG`. 719 HelmFQNConfig *HelmFQNConfig `yaml:"fqn,omitempty" yamltags:"oneOf=helmImageStrategy"` 720 721 // HelmConventionConfig is the image configuration uses the syntax `IMAGE-NAME.repository=IMAGE-REPOSITORY, IMAGE-NAME.tag=IMAGE-TAG`. 722 HelmConventionConfig *HelmConventionConfig `yaml:"helm,omitempty" yamltags:"oneOf=helmImageStrategy"` 723 } 724 725 // HelmFQNConfig is the image config to use the FullyQualifiedImageName as param to set. 726 type HelmFQNConfig struct { 727 // Property defines the image config. 728 Property string `yaml:"property,omitempty"` 729 } 730 731 // HelmConventionConfig is the image config in the syntax of image.repository and image.tag. 732 type HelmConventionConfig struct { 733 // ExplicitRegistry separates `image.registry` to the image config syntax. Useful for some charts e.g. `postgresql`. 734 ExplicitRegistry bool `yaml:"explicitRegistry,omitempty"` 735 } 736 737 // LogsConfig configures how container logs are printed as a result of a deployment. 738 type LogsConfig struct { 739 // Prefix defines the prefix shown on each log line. Valid values are 740 // `container`: prefix logs lines with the name of the container. 741 // `podAndContainer`: prefix logs lines with the names of the pod and of the container. 742 // `auto`: same as `podAndContainer` except that the pod name is skipped if it's the same as the container name. 743 // `none`: don't add a prefix. 744 // Defaults to `auto`. 745 Prefix string `yaml:"prefix,omitempty"` 746 } 747 748 // Artifact are the items that need to be built, along with the context in which 749 // they should be built. 750 type Artifact struct { 751 // ImageName is the name of the image to be built. 752 // For example: `gcr.io/k8s-skaffold/example`. 753 ImageName string `yaml:"image,omitempty" yamltags:"required"` 754 755 // Workspace is the directory containing the artifact's sources. 756 // Defaults to `.`. 757 Workspace string `yaml:"context,omitempty"` 758 759 // Sync *beta* lists local files synced to pods instead 760 // of triggering an image build when modified. 761 // If no files are listed, sync all the files and infer the destination. 762 // Defaults to `infer: ["**/*"]`. 763 Sync *Sync `yaml:"sync,omitempty"` 764 765 // ArtifactType describes how to build an artifact. 766 ArtifactType `yaml:",inline"` 767 768 // Dependencies describes build artifacts that this artifact depends on. 769 Dependencies []*ArtifactDependency `yaml:"requires,omitempty"` 770 } 771 772 // Sync *beta* specifies what files to sync into the container. 773 // This is a list of sync rules indicating the intent to sync for source files. 774 // If no files are listed, sync all the files and infer the destination. 775 // Defaults to `infer: ["**/*"]`. 776 type Sync struct { 777 // Manual lists manual sync rules indicating the source and destination. 778 Manual []*SyncRule `yaml:"manual,omitempty" yamltags:"oneOf=sync"` 779 780 // Infer lists file patterns which may be synced into the container 781 // The container destination is inferred by the builder 782 // based on the instructions of a Dockerfile. 783 // Available for docker and kaniko artifacts and custom 784 // artifacts that declare dependencies on a dockerfile. 785 Infer []string `yaml:"infer,omitempty" yamltags:"oneOf=sync"` 786 787 // Auto delegates discovery of sync rules to the build system. 788 // Only available for jib and buildpacks. 789 Auto *bool `yaml:"auto,omitempty" yamltags:"oneOf=sync"` 790 } 791 792 // SyncRule specifies which local files to sync to remote folders. 793 type SyncRule struct { 794 // Src is a glob pattern to match local paths against. 795 // Directories should be delimited by `/` on all platforms. 796 // For example: `"css/**/*.css"`. 797 Src string `yaml:"src,omitempty" yamltags:"required"` 798 799 // Dest is the destination path in the container where the files should be synced to. 800 // For example: `"app/"` 801 Dest string `yaml:"dest,omitempty" yamltags:"required"` 802 803 // Strip specifies the path prefix to remove from the source path when 804 // transplanting the files into the destination folder. 805 // For example: `"css/"` 806 Strip string `yaml:"strip,omitempty"` 807 } 808 809 // Profile is used to override any `build`, `test` or `deploy` configuration. 810 type Profile struct { 811 // Name is a unique profile name. 812 // For example: `profile-prod`. 813 Name string `yaml:"name,omitempty" yamltags:"required"` 814 815 // Activation criteria by which a profile can be auto-activated. 816 // The profile is auto-activated if any one of the activations are triggered. 817 // An activation is triggered if all of the criteria (env, kubeContext, command) are triggered. 818 Activation []Activation `yaml:"activation,omitempty"` 819 820 // Patches lists patches applied to the configuration. 821 // Patches use the JSON patch notation. 822 Patches []JSONPatch `yaml:"patches,omitempty"` 823 824 // Pipeline contains the definitions to replace the default skaffold pipeline. 825 Pipeline `yaml:",inline"` 826 } 827 828 // JSONPatch patch to be applied by a profile. 829 type JSONPatch struct { 830 // Op is the operation carried by the patch: `add`, `remove`, `replace`, `move`, `copy` or `test`. 831 // Defaults to `replace`. 832 Op string `yaml:"op,omitempty"` 833 834 // Path is the position in the yaml where the operation takes place. 835 // For example, this targets the `dockerfile` of the first artifact built. 836 // For example: `/build/artifacts/0/docker/dockerfile`. 837 Path string `yaml:"path,omitempty" yamltags:"required"` 838 839 // From is the source position in the yaml, used for `copy` or `move` operations. 840 From string `yaml:"from,omitempty"` 841 842 // Value is the value to apply. Can be any portion of yaml. 843 Value *util.YamlpatchNode `yaml:"value,omitempty"` 844 } 845 846 // Activation criteria by which a profile is auto-activated. 847 type Activation struct { 848 // Env is a `key=pattern` pair. The profile is auto-activated if an Environment 849 // Variable `key` matches the pattern. If the pattern starts with `!`, activation 850 // happens if the remaining pattern is _not_ matched. The pattern matches if the 851 // Environment Variable value is exactly `pattern`, or the regex `pattern` is 852 // found in it. An empty `pattern` (e.g. `env: "key="`) always only matches if 853 // the Environment Variable is undefined or empty. 854 // For example: `ENV=production` 855 Env string `yaml:"env,omitempty"` 856 857 // KubeContext is a Kubernetes context for which the profile is auto-activated. 858 // For example: `minikube`. 859 KubeContext string `yaml:"kubeContext,omitempty"` 860 861 // Command is a Skaffold command for which the profile is auto-activated. 862 // For example: `dev`. 863 Command string `yaml:"command,omitempty"` 864 } 865 866 // ArtifactType describes how to build an artifact. 867 type ArtifactType struct { 868 // DockerArtifact *beta* describes an artifact built from a Dockerfile. 869 DockerArtifact *DockerArtifact `yaml:"docker,omitempty" yamltags:"oneOf=artifact"` 870 871 // BazelArtifact *beta* requires bazel CLI to be installed and the sources to 872 // contain [Bazel](https://bazel.build/) configuration files. 873 BazelArtifact *BazelArtifact `yaml:"bazel,omitempty" yamltags:"oneOf=artifact"` 874 875 // JibArtifact builds images using the 876 // [Jib plugins for Maven or Gradle](https://github.com/GoogleContainerTools/jib/). 877 JibArtifact *JibArtifact `yaml:"jib,omitempty" yamltags:"oneOf=artifact"` 878 879 // KanikoArtifact builds images using [kaniko](https://github.com/GoogleContainerTools/kaniko). 880 KanikoArtifact *KanikoArtifact `yaml:"kaniko,omitempty" yamltags:"oneOf=artifact"` 881 882 // BuildpackArtifact builds images using [Cloud Native Buildpacks](https://buildpacks.io/). 883 BuildpackArtifact *BuildpackArtifact `yaml:"buildpacks,omitempty" yamltags:"oneOf=artifact"` 884 885 // CustomArtifact *beta* builds images using a custom build script written by the user. 886 CustomArtifact *CustomArtifact `yaml:"custom,omitempty" yamltags:"oneOf=artifact"` 887 } 888 889 // ArtifactDependency describes a specific build dependency for an artifact. 890 type ArtifactDependency struct { 891 // ImageName is a reference to an artifact's image name. 892 ImageName string `yaml:"image" yamltags:"required"` 893 // Alias is a token that is replaced with the image reference in the builder definition files. 894 // For example, the `docker` builder will use the alias as a build-arg key. 895 // Defaults to the value of `image`. 896 Alias string `yaml:"alias,omitempty"` 897 } 898 899 // BuildpackArtifact *alpha* describes an artifact built using [Cloud Native Buildpacks](https://buildpacks.io/). 900 // It can be used to build images out of project's sources without any additional configuration. 901 type BuildpackArtifact struct { 902 // Builder is the builder image used. 903 Builder string `yaml:"builder" yamltags:"required"` 904 905 // RunImage overrides the stack's default run image. 906 RunImage string `yaml:"runImage,omitempty"` 907 908 // Env are environment variables, in the `key=value` form, passed to the build. 909 // Values can use the go template syntax. 910 // For example: `["key1=value1", "key2=value2", "key3={{.ENV_VARIABLE}}"]`. 911 Env []string `yaml:"env,omitempty"` 912 913 // Buildpacks is a list of strings, where each string is a specific buildpack to use with the builder. 914 // If you specify buildpacks the builder image automatic detection will be ignored. These buildpacks will be used to build the Image from your source code. 915 // Order matters. 916 Buildpacks []string `yaml:"buildpacks,omitempty"` 917 918 // TrustBuilder indicates that the builder should be trusted. 919 TrustBuilder bool `yaml:"trustBuilder,omitempty"` 920 921 // ProjectDescriptor is the path to the project descriptor file. 922 // Defaults to `project.toml` if it exists. 923 ProjectDescriptor string `yaml:"projectDescriptor,omitempty"` 924 925 // Dependencies are the file dependencies that skaffold should watch for both rebuilding and file syncing for this artifact. 926 Dependencies *BuildpackDependencies `yaml:"dependencies,omitempty"` 927 } 928 929 // BuildpackDependencies *alpha* is used to specify dependencies for an artifact built by buildpacks. 930 type BuildpackDependencies struct { 931 // Paths should be set to the file dependencies for this artifact, so that the skaffold file watcher knows when to rebuild and perform file synchronization. 932 Paths []string `yaml:"paths,omitempty" yamltags:"oneOf=dependency"` 933 934 // Ignore specifies the paths that should be ignored by skaffold's file watcher. If a file exists in both `paths` and in `ignore`, it will be ignored, and will be excluded from both rebuilds and file synchronization. 935 // Will only work in conjunction with `paths`. 936 Ignore []string `yaml:"ignore,omitempty"` 937 } 938 939 // CustomArtifact *beta* describes an artifact built from a custom build script 940 // written by the user. It can be used to build images with builders that aren't directly integrated with skaffold. 941 type CustomArtifact struct { 942 // BuildCommand is the command executed to build the image. 943 BuildCommand string `yaml:"buildCommand,omitempty"` 944 // Dependencies are the file dependencies that skaffold should watch for both rebuilding and file syncing for this artifact. 945 Dependencies *CustomDependencies `yaml:"dependencies,omitempty"` 946 } 947 948 // CustomDependencies *beta* is used to specify dependencies for an artifact built by a custom build script. 949 // Either `dockerfile` or `paths` should be specified for file watching to work as expected. 950 type CustomDependencies struct { 951 // Dockerfile should be set if the artifact is built from a Dockerfile, from which skaffold can determine dependencies. 952 Dockerfile *DockerfileDependency `yaml:"dockerfile,omitempty" yamltags:"oneOf=dependency"` 953 954 // Command represents a custom command that skaffold executes to obtain dependencies. The output of this command *must* be a valid JSON array. 955 Command string `yaml:"command,omitempty" yamltags:"oneOf=dependency"` 956 957 // Paths should be set to the file dependencies for this artifact, so that the skaffold file watcher knows when to rebuild and perform file synchronization. 958 Paths []string `yaml:"paths,omitempty" yamltags:"oneOf=dependency"` 959 960 // Ignore specifies the paths that should be ignored by skaffold's file watcher. If a file exists in both `paths` and in `ignore`, it will be ignored, and will be excluded from both rebuilds and file synchronization. 961 // Will only work in conjunction with `paths`. 962 Ignore []string `yaml:"ignore,omitempty"` 963 } 964 965 // DockerfileDependency *beta* is used to specify a custom build artifact that is built from a Dockerfile. This allows skaffold to determine dependencies from the Dockerfile. 966 type DockerfileDependency struct { 967 // Path locates the Dockerfile relative to workspace. 968 Path string `yaml:"path,omitempty"` 969 970 // BuildArgs are key/value pairs used to resolve values of `ARG` instructions in a Dockerfile. 971 // Values can be constants or environment variables via the go template syntax. 972 // For example: `{"key1": "value1", "key2": "value2", "key3": "'{{.ENV_VARIABLE}}'"}`. 973 BuildArgs map[string]*string `yaml:"buildArgs,omitempty"` 974 } 975 976 // KanikoArtifact describes an artifact built from a Dockerfile, 977 // with kaniko. 978 type KanikoArtifact struct { 979 980 // Cleanup to clean the filesystem at the end of the build. 981 Cleanup bool `yaml:"cleanup,omitempty"` 982 983 // Insecure if you want to push images to a plain HTTP registry. 984 Insecure bool `yaml:"insecure,omitempty"` 985 986 // InsecurePull if you want to pull images from a plain HTTP registry. 987 InsecurePull bool `yaml:"insecurePull,omitempty"` 988 989 // NoPush if you only want to build the image, without pushing to a registry. 990 NoPush bool `yaml:"noPush,omitempty"` 991 992 // Force building outside of a container. 993 Force bool `yaml:"force,omitempty"` 994 995 // LogTimestamp to add timestamps to log format. 996 LogTimestamp bool `yaml:"logTimestamp,omitempty"` 997 998 // Reproducible is used to strip timestamps out of the built image. 999 Reproducible bool `yaml:"reproducible,omitempty"` 1000 1001 // SingleSnapshot is takes a single snapshot of the filesystem at the end of the build. 1002 // So only one layer will be appended to the base image. 1003 SingleSnapshot bool `yaml:"singleSnapshot,omitempty"` 1004 1005 // SkipTLS skips TLS certificate validation when pushing to a registry. 1006 SkipTLS bool `yaml:"skipTLS,omitempty"` 1007 1008 // SkipTLSVerifyPull skips TLS certificate validation when pulling from a registry. 1009 SkipTLSVerifyPull bool `yaml:"skipTLSVerifyPull,omitempty"` 1010 1011 // SkipUnusedStages builds only used stages if defined to true. 1012 // Otherwise it builds by default all stages, even the unnecessaries ones until it reaches the target stage / end of Dockerfile. 1013 SkipUnusedStages bool `yaml:"skipUnusedStages,omitempty"` 1014 1015 // UseNewRun to Use the experimental run implementation for detecting changes without requiring file system snapshots. 1016 // In some cases, this may improve build performance by 75%. 1017 UseNewRun bool `yaml:"useNewRun,omitempty"` 1018 1019 // WhitelistVarRun is used to ignore `/var/run` when taking image snapshot. 1020 // Set it to false to preserve /var/run/* in destination image. 1021 WhitelistVarRun bool `yaml:"whitelistVarRun,omitempty"` 1022 1023 // DockerfilePath locates the Dockerfile relative to workspace. 1024 // Defaults to `Dockerfile`. 1025 DockerfilePath string `yaml:"dockerfile,omitempty"` 1026 1027 // Target is to indicate which build stage is the target build stage. 1028 Target string `yaml:"target,omitempty"` 1029 1030 // InitImage is the image used to run init container which mounts kaniko context. 1031 InitImage string `yaml:"initImage,omitempty"` 1032 1033 // Image is the Docker image used by the Kaniko pod. 1034 // Defaults to the latest released version of `gcr.io/kaniko-project/executor`. 1035 Image string `yaml:"image,omitempty"` 1036 1037 // DigestFile to specify a file in the container. This file will receive the digest of a built image. 1038 // This can be used to automatically track the exact image built by kaniko. 1039 DigestFile string `yaml:"digestFile,omitempty"` 1040 1041 // ImageNameWithDigestFile specify a file to save the image name with digest of the built image to. 1042 ImageNameWithDigestFile string `yaml:"imageNameWithDigestFile,omitempty"` 1043 1044 // LogFormat <text|color|json> to set the log format. 1045 LogFormat string `yaml:"logFormat,omitempty"` 1046 1047 // OCILayoutPath is to specify a directory in the container where the OCI image layout of a built image will be placed. 1048 // This can be used to automatically track the exact image built by kaniko. 1049 OCILayoutPath string `yaml:"ociLayoutPath,omitempty"` 1050 1051 // RegistryMirror if you want to use a registry mirror instead of default `index.docker.io`. 1052 RegistryMirror string `yaml:"registryMirror,omitempty"` 1053 1054 // SnapshotMode is how Kaniko will snapshot the filesystem. 1055 SnapshotMode string `yaml:"snapshotMode,omitempty"` 1056 1057 // TarPath is path to save the image as a tarball at path instead of pushing the image. 1058 TarPath string `yaml:"tarPath,omitempty"` 1059 1060 // Verbosity <panic|fatal|error|warn|info|debug|trace> to set the logging level. 1061 Verbosity string `yaml:"verbosity,omitempty"` 1062 1063 // InsecureRegistry is to use plain HTTP requests when accessing a registry. 1064 InsecureRegistry []string `yaml:"insecureRegistry,omitempty"` 1065 1066 // SkipTLSVerifyRegistry skips TLS certificate validation when accessing a registry. 1067 SkipTLSVerifyRegistry []string `yaml:"skipTLSVerifyRegistry,omitempty"` 1068 1069 // Env are environment variables passed to the kaniko pod. 1070 // It also accepts environment variables via the go template syntax. 1071 // For example: `[{"name": "key1", "value": "value1"}, {"name": "key2", "value": "value2"}, {"name": "key3", "value": "'{{.ENV_VARIABLE}}'"}]`. 1072 Env []v1.EnvVar `yaml:"env,omitempty"` 1073 1074 // Cache configures Kaniko caching. If a cache is specified, Kaniko will 1075 // use a remote cache which will speed up builds. 1076 Cache *KanikoCache `yaml:"cache,omitempty"` 1077 1078 // RegistryCertificate is to provide a certificate for TLS communication with a given registry. 1079 // my.registry.url: /path/to/the/certificate.cert is the expected format. 1080 RegistryCertificate map[string]*string `yaml:"registryCertificate,omitempty"` 1081 1082 // Label key: value to set some metadata to the final image. 1083 // This is equivalent as using the LABEL within the Dockerfile. 1084 Label map[string]*string `yaml:"label,omitempty"` 1085 1086 // BuildArgs are arguments passed to the docker build. 1087 // It also accepts environment variables and generated values via the go template syntax. 1088 // Exposed generated values: IMAGE_REPO, IMAGE_NAME, IMAGE_TAG. 1089 // For example: `{"key1": "value1", "key2": "value2", "key3": "'{{.ENV_VARIABLE}}'"}`. 1090 BuildArgs map[string]*string `yaml:"buildArgs,omitempty"` 1091 1092 // VolumeMounts are volume mounts passed to kaniko pod. 1093 VolumeMounts []v1.VolumeMount `yaml:"volumeMounts,omitempty"` 1094 } 1095 1096 // DockerArtifact describes an artifact built from a Dockerfile, 1097 // usually using `docker build`. 1098 type DockerArtifact struct { 1099 // DockerfilePath locates the Dockerfile relative to workspace. 1100 // Defaults to `Dockerfile`. 1101 DockerfilePath string `yaml:"dockerfile,omitempty"` 1102 1103 // Target is the Dockerfile target name to build. 1104 Target string `yaml:"target,omitempty"` 1105 1106 // BuildArgs are arguments passed to the docker build. 1107 // For example: `{"key1": "value1", "key2": "value2"}`. 1108 BuildArgs map[string]*string `yaml:"buildArgs,omitempty"` 1109 1110 // NetworkMode is passed through to docker and overrides the 1111 // network configuration of docker builder. If unset, use whatever 1112 // is configured in the underlying docker daemon. Valid modes are 1113 // `host`: use the host's networking stack. 1114 // `bridge`: use the bridged network configuration. 1115 // `none`: no networking in the container. 1116 NetworkMode string `yaml:"network,omitempty"` 1117 1118 // CacheFrom lists the Docker images used as cache sources. 1119 // For example: `["golang:1.10.1-alpine3.7", "alpine:3.7"]`. 1120 CacheFrom []string `yaml:"cacheFrom,omitempty"` 1121 1122 // NoCache used to pass in --no-cache to docker build to prevent caching. 1123 NoCache bool `yaml:"noCache,omitempty"` 1124 1125 // Secret contains information about a local secret passed to `docker build`, 1126 // along with optional destination information. 1127 Secret *DockerSecret `yaml:"secret,omitempty"` 1128 1129 // SSH is used to pass in --ssh to docker build to use SSH agent. Format is "default|<id>[=<socket>|<key>[,<key>]]". 1130 SSH string `yaml:"ssh,omitempty"` 1131 } 1132 1133 // DockerSecret contains information about a local secret passed to `docker build`, 1134 // along with optional destination information. 1135 type DockerSecret struct { 1136 // ID is the id of the secret. 1137 ID string `yaml:"id,omitempty" yamltags:"required"` 1138 1139 // Source is the path to the secret on the host machine. 1140 Source string `yaml:"src,omitempty"` 1141 1142 // Destination is the path in the container to mount the secret. 1143 Destination string `yaml:"dst,omitempty"` 1144 } 1145 1146 // BazelArtifact describes an artifact built with [Bazel](https://bazel.build/). 1147 type BazelArtifact struct { 1148 // BuildTarget is the `bazel build` target to run. 1149 // For example: `//:skaffold_example.tar`. 1150 BuildTarget string `yaml:"target,omitempty" yamltags:"required"` 1151 1152 // BuildArgs are additional args to pass to `bazel build`. 1153 // For example: `["-flag", "--otherflag"]`. 1154 BuildArgs []string `yaml:"args,omitempty"` 1155 } 1156 1157 // JibArtifact builds images using the 1158 // [Jib plugins for Maven and Gradle](https://github.com/GoogleContainerTools/jib/). 1159 type JibArtifact struct { 1160 // Project selects which sub-project to build for multi-module builds. 1161 Project string `yaml:"project,omitempty"` 1162 1163 // Flags are additional build flags passed to the builder. 1164 // For example: `["--no-build-cache"]`. 1165 Flags []string `yaml:"args,omitempty"` 1166 1167 // Type the Jib builder type; normally determined automatically. Valid types are 1168 // `maven`: for Maven. 1169 // `gradle`: for Gradle. 1170 Type string `yaml:"type,omitempty"` 1171 1172 // BaseImage overrides the configured jib base image. 1173 BaseImage string `yaml:"fromImage,omitempty"` 1174 }