github.com/GoogleContainerTools/skaffold@v1.39.18/pkg/skaffold/schema/latest/v2/config.go (about) 1 /* 2 Copyright 2021 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 v2 18 19 import ( 20 "encoding/json" 21 22 v1 "k8s.io/api/core/v1" 23 "sigs.k8s.io/kustomize/kyaml/yaml" 24 25 "github.com/GoogleContainerTools/skaffold/pkg/skaffold/schema/util" 26 ) 27 28 // This config version is not yet released, it is SAFE TO MODIFY the structs in this file. 29 const Version string = "skaffold/v3alpha2" 30 31 // NewSkaffoldConfig creates a SkaffoldConfig 32 func NewSkaffoldConfig() util.VersionedConfig { 33 return new(SkaffoldConfig) 34 } 35 36 func (c *SkaffoldConfig) GetVersion() string { 37 return c.APIVersion 38 } 39 40 // SkaffoldConfig holds the fields parsed from the Skaffold configuration file (skaffold.yaml). 41 type SkaffoldConfig struct { 42 // APIVersion is the version of the configuration. 43 APIVersion string `yaml:"apiVersion" yamltags:"required"` 44 45 // Kind is always `Config`. Defaults to `Config`. 46 Kind string `yaml:"kind" yamltags:"required"` 47 48 // Metadata holds additional information about the config. 49 Metadata Metadata `yaml:"metadata,omitempty"` 50 51 // Dependencies describes a list of other required configs for the current config. 52 Dependencies []ConfigDependency `yaml:"requires,omitempty"` 53 54 // Pipeline defines the Build/Test/Deploy phases. 55 Pipeline `yaml:",inline"` 56 57 // Profiles *beta* can override be used to `build`, `test` or `deploy` configuration. 58 Profiles []Profile `yaml:"profiles,omitempty"` 59 } 60 61 // Metadata holds an optional name of the project. 62 type Metadata struct { 63 // Name is an identifier for the project. 64 Name string `yaml:"name,omitempty"` 65 66 // Labels is a map of labels identifying the project. 67 Labels map[string]string `yaml:"labels,omitempty"` 68 69 // Annotations is a map of annotations providing additional 70 // metadata about the project. 71 Annotations map[string]string `yaml:"annotations,omitempty"` 72 } 73 74 // Pipeline describes a Skaffold pipeline. 75 type Pipeline struct { 76 // Build describes how images are built. 77 Build BuildConfig `yaml:"build,omitempty"` 78 79 // Test describes how images are tested. 80 Test []*TestCase `yaml:"test,omitempty"` 81 82 // Render describes how the original manifests are hydrated, validated and transformed. 83 Render RenderConfig `yaml:"manifests,omitempty"` 84 85 // Deploy describes how the manifests are deployed. 86 Deploy DeployConfig `yaml:"deploy,omitempty"` 87 88 // PortForward describes user defined resources to port-forward. 89 PortForward []*PortForwardResource `yaml:"portForward,omitempty"` 90 } 91 92 // GitInfo contains information on the origin of skaffold configurations cloned from a git repository. 93 type GitInfo struct { 94 // Repo is the git repository the package should be cloned from. e.g. `https://github.com/GoogleContainerTools/skaffold.git`. 95 Repo string `yaml:"repo" yamltags:"required"` 96 97 // Path is the relative path from the repo root to the skaffold configuration file. eg. `getting-started/skaffold.yaml`. 98 Path string `yaml:"path,omitempty"` 99 100 // Ref is the git ref the package should be cloned from. eg. `master` or `main`. 101 Ref string `yaml:"ref,omitempty"` 102 103 // Sync when set to `true` will reset the cached repository to the latest commit from remote on every run. To use the cached repository with uncommitted changes or unpushed commits, it needs to be set to `false`. 104 Sync *bool `yaml:"sync,omitempty"` 105 } 106 107 // ConfigDependency describes a dependency on another skaffold configuration. 108 type ConfigDependency struct { 109 // Names includes specific named configs within the file path. If empty, then all configs in the file are included. 110 Names []string `yaml:"configs,omitempty"` 111 112 // Path describes the path to the file containing the required configs. 113 Path string `yaml:"path,omitempty" skaffold:"filepath" yamltags:"oneOf=paths"` 114 115 // GitRepo describes a remote git repository containing the required configs. 116 GitRepo *GitInfo `yaml:"git,omitempty" yamltags:"oneOf=paths"` 117 118 // ActiveProfiles describes the list of profiles to activate when resolving the required configs. These profiles must exist in the imported config. 119 ActiveProfiles []ProfileDependency `yaml:"activeProfiles,omitempty"` 120 } 121 122 // ProfileDependency describes a mapping from referenced config profiles to the current config profiles. 123 // If the current config is activated with a profile in this mapping then the dependency configs are also activated with the corresponding mapped profiles. 124 type ProfileDependency struct { 125 // Name describes name of the profile to activate in the dependency config. It should exist in the dependency config. 126 Name string `yaml:"name" yamltags:"required"` 127 128 // ActivatedBy describes a list of profiles in the current config that when activated will also activate the named profile in the dependency config. If empty then the named profile is always activated. 129 ActivatedBy []string `yaml:"activatedBy,omitempty"` 130 } 131 132 // ResourceType describes the Kubernetes resource types used for port forwarding. 133 type ResourceType string 134 135 // PortForwardResource describes a resource to port forward. 136 type PortForwardResource struct { 137 // Type is the Kubernetes type that should be port forwarded. 138 // Acceptable resource types include: `Service`, `Pod` and Controller resource type that has a pod spec: `ReplicaSet`, `ReplicationController`, `Deployment`, `StatefulSet`, `DaemonSet`, `Job`, `CronJob`. 139 Type ResourceType `yaml:"resourceType,omitempty"` 140 141 // Name is the name of the Kubernetes resource to port forward. 142 Name string `yaml:"resourceName,omitempty"` 143 144 // Namespace is the namespace of the resource to port forward. 145 Namespace string `yaml:"namespace,omitempty"` 146 147 // Port is the resource port that will be forwarded. 148 Port util.IntOrString `yaml:"port,omitempty"` 149 150 // Address is the local address to bind to. Defaults to the loopback address 127.0.0.1. 151 Address string `yaml:"address,omitempty"` 152 153 // LocalPort is the local port to forward to. If the port is unavailable, Skaffold will choose a random open port to forward to. *Optional*. 154 LocalPort int `yaml:"localPort,omitempty"` 155 } 156 157 // BuildConfig contains all the configuration for the build steps. 158 type BuildConfig struct { 159 // Artifacts lists the images you're going to be building. 160 Artifacts []*Artifact `yaml:"artifacts,omitempty"` 161 162 // InsecureRegistries is a list of registries declared by the user to be insecure. 163 // These registries will be connected to via HTTP instead of HTTPS. 164 InsecureRegistries []string `yaml:"insecureRegistries,omitempty"` 165 166 // TagPolicy *beta* determines how images are tagged. 167 // A few strategies are provided here, although you most likely won't need to care! 168 // If not specified, it defaults to `gitCommit: {variant: Tags}`. 169 TagPolicy TagPolicy `yaml:"tagPolicy,omitempty"` 170 171 BuildType `yaml:",inline"` 172 } 173 174 // TagPolicy contains all the configuration for the tagging step. 175 type TagPolicy struct { 176 // GitTagger *beta* tags images with the git tag or commit of the artifact's workspace. 177 GitTagger *GitTagger `yaml:"gitCommit,omitempty" yamltags:"oneOf=tag"` 178 179 // ShaTagger *beta* tags images with their sha256 digest. 180 ShaTagger *ShaTagger `yaml:"sha256,omitempty" yamltags:"oneOf=tag"` 181 182 // EnvTemplateTagger *beta* tags images with a configurable template string. 183 EnvTemplateTagger *EnvTemplateTagger `yaml:"envTemplate,omitempty" yamltags:"oneOf=tag"` 184 185 // DateTimeTagger *beta* tags images with the build timestamp. 186 DateTimeTagger *DateTimeTagger `yaml:"dateTime,omitempty" yamltags:"oneOf=tag"` 187 188 // CustomTemplateTagger *beta* tags images with a configurable template string *composed of other taggers*. 189 CustomTemplateTagger *CustomTemplateTagger `yaml:"customTemplate,omitempty" yamltags:"oneOf=tag"` 190 191 // InputDigest *beta* tags images with their sha256 digest of their content. 192 InputDigest *InputDigest `yaml:"inputDigest,omitempty" yamltags:"oneOf=tag"` 193 } 194 195 // ShaTagger *beta* tags images with their sha256 digest. 196 type ShaTagger struct{} 197 198 // InputDigest *beta* tags hashes the image content. 199 type InputDigest struct{} 200 201 // GitTagger *beta* tags images with the git tag or commit of the artifact's workspace. 202 type GitTagger struct { 203 // Variant determines the behavior of the git tagger. Valid variants are: 204 // `Tags` (default): use git tags or fall back to abbreviated commit hash. 205 // `CommitSha`: use the full git commit sha. 206 // `AbbrevCommitSha`: use the abbreviated git commit sha. 207 // `TreeSha`: use the full tree hash of the artifact workingdir. 208 // `AbbrevTreeSha`: use the abbreviated tree hash of the artifact workingdir. 209 Variant string `yaml:"variant,omitempty"` 210 211 // Prefix adds a fixed prefix to the tag. 212 Prefix string `yaml:"prefix,omitempty"` 213 214 // IgnoreChanges specifies whether to omit the `-dirty` postfix if there are uncommitted changes. 215 IgnoreChanges bool `yaml:"ignoreChanges,omitempty"` 216 } 217 218 // EnvTemplateTagger *beta* tags images with a configurable template string. 219 type EnvTemplateTagger struct { 220 // Template used to produce the image name and tag. 221 // See golang [text/template](https://golang.org/pkg/text/template/). 222 // The template is executed against the current environment, 223 // with those variables injected. 224 // For example: `{{.RELEASE}}`. 225 Template string `yaml:"template,omitempty" yamltags:"required"` 226 } 227 228 // DateTimeTagger *beta* tags images with the build timestamp. 229 type DateTimeTagger struct { 230 // Format formats the date and time. 231 // See [#Time.Format](https://golang.org/pkg/time/#Time.Format). 232 // Defaults to `2006-01-02_15-04-05.999_MST`. 233 Format string `yaml:"format,omitempty"` 234 235 // TimeZone sets the timezone for the date and time. 236 // See [Time.LoadLocation](https://golang.org/pkg/time/#Time.LoadLocation). 237 // Defaults to the local timezone. 238 TimeZone string `yaml:"timezone,omitempty"` 239 } 240 241 // CustomTemplateTagger *beta* tags images with a configurable template string. 242 type CustomTemplateTagger struct { 243 // Template used to produce the image name and tag. 244 // See golang [text/template](https://golang.org/pkg/text/template/). 245 // The template is executed against the provided components with those variables injected. 246 // For example: `{{.DATE}}` where DATE references a TaggerComponent. 247 Template string `yaml:"template,omitempty" yamltags:"required"` 248 249 // Components lists TaggerComponents that the template (see field above) can be executed against. 250 Components []TaggerComponent `yaml:"components,omitempty"` 251 } 252 253 // TaggerComponent *beta* is a component of CustomTemplateTagger. 254 type TaggerComponent struct { 255 // Name is an identifier for the component. 256 Name string `yaml:"name,omitempty"` 257 258 // Component is a tagging strategy to be used in CustomTemplateTagger. 259 Component TagPolicy `yaml:",inline" yamltags:"skipTrim"` 260 } 261 262 // BuildType contains the specific implementation and parameters needed 263 // for the build step. Only one field should be populated. 264 type BuildType struct { 265 // LocalBuild *beta* describes how to do a build on the local docker daemon 266 // and optionally push to a repository. 267 LocalBuild *LocalBuild `yaml:"local,omitempty" yamltags:"oneOf=build"` 268 269 // GoogleCloudBuild *beta* describes how to do a remote build on 270 // [Google Cloud Build](https://cloud.google.com/cloud-build/). 271 GoogleCloudBuild *GoogleCloudBuild `yaml:"googleCloudBuild,omitempty" yamltags:"oneOf=build"` 272 273 // Cluster *beta* describes how to do an on-cluster build. 274 Cluster *ClusterDetails `yaml:"cluster,omitempty" yamltags:"oneOf=build"` 275 } 276 277 // LocalBuild *beta* describes how to do a build on the local docker daemon 278 // and optionally push to a repository. 279 type LocalBuild struct { 280 // Push should images be pushed to a registry. 281 // If not specified, images are pushed only if the current Kubernetes context 282 // connects to a remote cluster. 283 Push *bool `yaml:"push,omitempty"` 284 285 // TryImportMissing whether to attempt to import artifacts from 286 // Docker (either a local or remote registry) if not in the cache. 287 TryImportMissing bool `yaml:"tryImportMissing,omitempty"` 288 289 // UseDockerCLI use `docker` command-line interface instead of Docker Engine APIs. 290 UseDockerCLI bool `yaml:"useDockerCLI,omitempty"` 291 292 // UseBuildkit use BuildKit to build Docker images. If unspecified, uses the Docker default. 293 UseBuildkit *bool `yaml:"useBuildkit,omitempty"` 294 295 // Concurrency is how many artifacts can be built concurrently. 0 means "no-limit". 296 // Defaults to `1`. 297 Concurrency *int `yaml:"concurrency,omitempty"` 298 } 299 300 // GoogleCloudBuild *beta* describes how to do a remote build on 301 // [Google Cloud Build](https://cloud.google.com/cloud-build/docs/). 302 // Docker and Jib artifacts can be built on Cloud Build. The `projectId` needs 303 // to be provided and the currently logged in user should be given permissions to trigger 304 // new builds. 305 type GoogleCloudBuild struct { 306 // ProjectID is the ID of your Cloud Platform Project. 307 // If it is not provided, Skaffold will guess it from the image name. 308 // For example, given the artifact image name `gcr.io/myproject/image`, Skaffold 309 // will use the `myproject` GCP project. 310 ProjectID string `yaml:"projectId,omitempty"` 311 312 // DiskSizeGb is the disk size of the VM that runs the build. 313 // See [Cloud Build Reference](https://cloud.google.com/cloud-build/docs/api/reference/rest/v1/projects.builds#buildoptions). 314 DiskSizeGb int64 `yaml:"diskSizeGb,omitempty"` 315 316 // MachineType is the type of the VM that runs the build. 317 // See [Cloud Build Reference](https://cloud.google.com/cloud-build/docs/api/reference/rest/v1/projects.builds#buildoptions). 318 MachineType string `yaml:"machineType,omitempty"` 319 320 // Timeout is the amount of time (in seconds) that this build should be allowed to run. 321 // See [Cloud Build Reference](https://cloud.google.com/cloud-build/docs/api/reference/rest/v1/projects.builds#resource-build). 322 Timeout string `yaml:"timeout,omitempty"` 323 324 // Logging specifies the logging mode. 325 // Valid modes are: 326 // `LOGGING_UNSPECIFIED`: The service determines the logging mode. 327 // `LEGACY`: Stackdriver logging and Cloud Storage logging are enabled (default). 328 // `GCS_ONLY`: Only Cloud Storage logging is enabled. 329 // See [Cloud Build Reference](https://cloud.google.com/cloud-build/docs/api/reference/rest/v1/projects.builds#loggingmode). 330 Logging string `yaml:"logging,omitempty"` 331 332 // LogStreamingOption specifies the behavior when writing build logs to Google Cloud Storage. 333 // Valid options are: 334 // `STREAM_DEFAULT`: Service may automatically determine build log streaming behavior. 335 // `STREAM_ON`: Build logs should be streamed to Google Cloud Storage. 336 // `STREAM_OFF`: Build logs should not be streamed to Google Cloud Storage; they will be written when the build is completed. 337 // See [Cloud Build Reference](https://cloud.google.com/cloud-build/docs/api/reference/rest/v1/projects.builds#logstreamingoption). 338 LogStreamingOption string `yaml:"logStreamingOption,omitempty"` 339 340 // DockerImage is the image that runs a Docker build. 341 // See [Cloud Builders](https://cloud.google.com/cloud-build/docs/cloud-builders). 342 // Defaults to `gcr.io/cloud-builders/docker`. 343 DockerImage string `yaml:"dockerImage,omitempty"` 344 345 // KanikoImage is the image that runs a Kaniko build. 346 // See [Cloud Builders](https://cloud.google.com/cloud-build/docs/cloud-builders). 347 // Defaults to `gcr.io/kaniko-project/executor`. 348 KanikoImage string `yaml:"kanikoImage,omitempty"` 349 350 // MavenImage is the image that runs a Maven build. 351 // See [Cloud Builders](https://cloud.google.com/cloud-build/docs/cloud-builders). 352 // Defaults to `gcr.io/cloud-builders/mvn`. 353 MavenImage string `yaml:"mavenImage,omitempty"` 354 355 // GradleImage is the image that runs a Gradle build. 356 // See [Cloud Builders](https://cloud.google.com/cloud-build/docs/cloud-builders). 357 // Defaults to `gcr.io/cloud-builders/gradle`. 358 GradleImage string `yaml:"gradleImage,omitempty"` 359 360 // PackImage is the image that runs a Cloud Native Buildpacks build. 361 // See [Cloud Builders](https://cloud.google.com/cloud-build/docs/cloud-builders). 362 // Defaults to `gcr.io/k8s-skaffold/pack`. 363 PackImage string `yaml:"packImage,omitempty"` 364 365 // Concurrency is how many artifacts can be built concurrently. 0 means "no-limit". 366 // Defaults to `0`. 367 Concurrency int `yaml:"concurrency,omitempty"` 368 369 // WorkerPool configures a pool of workers to run the build. 370 WorkerPool string `yaml:"workerPool,omitempty"` 371 } 372 373 // KanikoCache configures Kaniko caching. If a cache is specified, Kaniko will 374 // use a remote cache which will speed up builds. 375 type KanikoCache struct { 376 // Repo is a remote repository to store cached layers. If none is specified, one will be 377 // inferred from the image name. See [Kaniko Caching](https://github.com/GoogleContainerTools/kaniko#caching). 378 Repo string `yaml:"repo,omitempty"` 379 // HostPath specifies a path on the host that is mounted to each pod as read only cache volume containing base images. 380 // If set, must exist on each node and prepopulated with kaniko-warmer. 381 HostPath string `yaml:"hostPath,omitempty"` 382 // TTL Cache timeout in hours. 383 TTL string `yaml:"ttl,omitempty"` 384 } 385 386 // ClusterDetails *beta* describes how to do an on-cluster build. 387 type ClusterDetails struct { 388 // HTTPProxy for kaniko pod. 389 HTTPProxy string `yaml:"HTTP_PROXY,omitempty"` 390 391 // HTTPSProxy for kaniko pod. 392 HTTPSProxy string `yaml:"HTTPS_PROXY,omitempty"` 393 394 // PullSecretPath is the path to the Google Cloud service account secret key file. 395 PullSecretPath string `yaml:"pullSecretPath,omitempty"` 396 397 // PullSecretName is the name of the Kubernetes secret for pulling base images 398 // and pushing the final image. If given, the secret needs to contain the Google Cloud 399 // service account secret key under the key `kaniko-secret`. 400 // Defaults to `kaniko-secret`. 401 PullSecretName string `yaml:"pullSecretName,omitempty"` 402 403 // PullSecretMountPath is the path the pull secret will be mounted at within the running container. 404 PullSecretMountPath string `yaml:"pullSecretMountPath,omitempty"` 405 406 // Namespace is the Kubernetes namespace. 407 // Defaults to current namespace in Kubernetes configuration. 408 Namespace string `yaml:"namespace,omitempty"` 409 410 // Timeout is the amount of time (in seconds) that this build is allowed to run. 411 // Defaults to 20 minutes (`20m`). 412 Timeout string `yaml:"timeout,omitempty"` 413 414 // DockerConfig describes how to mount the local Docker configuration into a pod. 415 DockerConfig *DockerConfig `yaml:"dockerConfig,omitempty"` 416 417 // ServiceAccountName describes the Kubernetes service account to use for the pod. 418 // Defaults to 'default'. 419 ServiceAccountName string `yaml:"serviceAccount,omitempty"` 420 421 // Tolerations describes the Kubernetes tolerations for the pod. 422 Tolerations []v1.Toleration `yaml:"tolerations,omitempty"` 423 424 // Annotations describes the Kubernetes annotations for the pod. 425 Annotations map[string]string `yaml:"annotations,omitempty"` 426 427 // RunAsUser defines the UID to request for running the container. 428 // If omitted, no SecurityContext will be specified for the pod and will therefore be inherited 429 // from the service account. 430 RunAsUser *int64 `yaml:"runAsUser,omitempty"` 431 432 // Resources define the resource requirements for the kaniko pod. 433 Resources *ResourceRequirements `yaml:"resources,omitempty"` 434 435 // Concurrency is how many artifacts can be built concurrently. 0 means "no-limit". 436 // Defaults to `0`. 437 Concurrency int `yaml:"concurrency,omitempty"` 438 439 // Volumes defines container mounts for ConfigMap and Secret resources. 440 Volumes []v1.Volume `yaml:"volumes,omitempty"` 441 442 // 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. 443 RandomPullSecret bool `yaml:"randomPullSecret,omitempty"` 444 445 // 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. 446 RandomDockerConfigSecret bool `yaml:"randomDockerConfigSecret,omitempty"` 447 } 448 449 // DockerConfig contains information about the docker `config.json` to mount. 450 type DockerConfig struct { 451 // Path is the path to the docker `config.json`. 452 Path string `yaml:"path,omitempty"` 453 454 // SecretName is the Kubernetes secret that contains the `config.json` Docker configuration. 455 // Note that the expected secret type is not 'kubernetes.io/dockerconfigjson' but 'Opaque'. 456 SecretName string `yaml:"secretName,omitempty"` 457 } 458 459 // ResourceRequirements describes the resource requirements for the kaniko pod. 460 type ResourceRequirements struct { 461 // 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. 462 Requests *ResourceRequirement `yaml:"requests,omitempty"` 463 464 // 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. 465 Limits *ResourceRequirement `yaml:"limits,omitempty"` 466 } 467 468 // ResourceRequirement stores the CPU/Memory requirements for the pod. 469 type ResourceRequirement struct { 470 // CPU the number cores to be used. 471 // For example: `2`, `2.0` or `200m`. 472 CPU string `yaml:"cpu,omitempty"` 473 474 // Memory the amount of memory to allocate to the pod. 475 // For example: `1Gi` or `1000Mi`. 476 Memory string `yaml:"memory,omitempty"` 477 478 // EphemeralStorage the amount of Ephemeral storage to allocate to the pod. 479 // For example: `1Gi` or `1000Mi`. 480 EphemeralStorage string `yaml:"ephemeralStorage,omitempty"` 481 482 // ResourceStorage the amount of resource storage to allocate to the pod. 483 // For example: `1Gi` or `1000Mi`. 484 ResourceStorage string `yaml:"resourceStorage,omitempty"` 485 } 486 487 // TestCase is a list of tests to run on images that Skaffold builds. 488 type TestCase struct { 489 // ImageName is the artifact on which to run those tests. 490 // For example: `gcr.io/k8s-skaffold/example`. 491 ImageName string `yaml:"image" yamltags:"required"` 492 493 // Workspace is the directory containing the test sources. 494 // Defaults to `.`. 495 Workspace string `yaml:"context,omitempty" skaffold:"filepath"` 496 497 // CustomTests lists the set of custom tests to run after an artifact is built. 498 CustomTests []CustomTest `yaml:"custom,omitempty"` 499 500 // StructureTests lists the [Container Structure Tests](https://github.com/GoogleContainerTools/container-structure-test) 501 // to run on that artifact. 502 // For example: `["./test/*"]`. 503 StructureTests []string `yaml:"structureTests,omitempty" skaffold:"filepath"` 504 505 // StructureTestArgs lists additional configuration arguments passed to `container-structure-test` binary. 506 // For example: `["--driver=tar", "--no-color", "-q"]`. 507 StructureTestArgs []string `yaml:"structureTestsArgs,omitempty"` 508 } 509 510 // RenderConfig contains all the configuration needed by the render steps. 511 type RenderConfig struct { 512 513 // Generate defines the dry manifests from a variety of sources. 514 Generate `yaml:",inline"` 515 516 // Transform defines a set of transformation operations to run in series 517 Transform *[]Transformer `yaml:"transform,omitempty"` 518 519 // Validate defines a set of validator operations to run in series. 520 Validate *[]Validator `yaml:"validate,omitempty"` 521 522 // Output is the path to the hydrated directory. 523 Output string `yaml:"output,omitempty"` 524 } 525 526 // Generate defines the dry manifests from a variety of sources. 527 type Generate struct { 528 RawK8s []string `yaml:"rawYaml,omitempty"` 529 Kustomize []string `yaml:"kustomize,omitempty"` 530 Helm Helm `yaml:"helm,omitempty"` 531 Kpt []string `yaml:"kpt,omitempty"` 532 } 533 534 type Helm struct { 535 Releases *[]HelmRelease `yaml:"releases,omitempty"` 536 } 537 538 // DeployType contains the specific implementation and parameters needed 539 // for the deploy step. All three deployer types can be used at the same 540 // time for hybrid workflows. 541 type GenerateType struct { 542 } 543 544 // Transformer describes the supported kpt transformers. 545 type Transformer struct { 546 // Name is the transformer name. Can only accept skaffold whitelisted tools. 547 Name string `yaml:"name" yamltags:"required"` 548 // ConfigMap allows users to provide additional config data to the kpt function. 549 ConfigMap []string `yaml:"configMap,omitempty"` 550 } 551 552 // Validator describes the supported kpt validators. 553 type Validator struct { 554 // Name is the Validator name. Can only accept skaffold whitelisted tools. 555 Name string `yaml:"name" yamltags:"required"` 556 // ConfigMap allows users to provide additional config data to the kpt function. 557 ConfigMap []string `yaml:"configMap,omitempty"` 558 } 559 560 // KptV2Deploy contains all the configuration needed by the deploy steps. 561 type KptV2Deploy struct { 562 563 // Dir is equivalent to the dir in `kpt live apply <dir>`. If not provided, skaffold renders the raw manifests 564 // and store them to a a hidden directory `.kpt-hydrated`, and deploys the hidden directory. 565 Dir string `yaml:"dir,omitempty"` 566 567 // InventoryID *alpha* is the identifier for a group of applied resources. 568 // This value is only needed when the `kpt live` is working on a pre-applied cluster resources. 569 InventoryID string `yaml:"inventoryID,omitempty"` 570 // InventoryNamespace *alpha* sets the inventory namespace. 571 InventoryNamespace string `yaml:"inventoryNamespace,omitempty"` 572 573 // PruneTimeout sets the time threshold to wait for all pruned resources to be deleted. 574 PruneTimeout string `yaml:"pruneTimeout,omitempty"` 575 // ReconcileTimeout sets the time threshold to wait for all resources to reach the current status. 576 ReconcileTimeout string `yaml:"reconcileTimeout,omitempty"` 577 } 578 579 // DeployConfig contains all the configuration needed by the deploy steps. 580 type DeployConfig struct { 581 DeployType `yaml:",inline"` 582 583 // StatusCheck *beta* enables waiting for deployments to stabilize. 584 StatusCheck *bool `yaml:"statusCheck,omitempty"` 585 586 // StatusCheckDeadlineSeconds *beta* is the deadline for deployments to stabilize in seconds. 587 StatusCheckDeadlineSeconds int `yaml:"statusCheckDeadlineSeconds,omitempty"` 588 589 // KubeContext is the Kubernetes context that Skaffold should deploy to. 590 // For example: `minikube`. 591 KubeContext string `yaml:"kubeContext,omitempty"` 592 593 // Logs configures how container logs are printed as a result of a deployment. 594 Logs LogsConfig `yaml:"logs,omitempty"` 595 } 596 597 // DeployType contains the specific implementation and parameters needed 598 // for the deploy step. All three deployer types can be used at the same 599 // time for hybrid workflows. 600 type DeployType struct { 601 // HelmDeploy *beta* uses the `helm` CLI to apply the charts to the cluster. 602 HelmDeploy *HelmDeploy `yaml:"helm,omitempty"` 603 604 // KptDeploy *alpha* uses the `kpt` CLI to manage and deploy manifests. 605 KptDeploy *KptDeploy `yaml:"kpt,omitempty"` 606 607 KptV2Deploy *KptV2Deploy `yaml:"kptV2,omitempty"` 608 609 // KubectlDeploy *beta* uses a client side `kubectl apply` to deploy manifests. 610 // You'll need a `kubectl` CLI version installed that's compatible with your cluster. 611 KubectlDeploy *KubectlDeploy `yaml:"kubectl,omitempty"` 612 613 // KustomizeDeploy *beta* uses the `kustomize` CLI to "patch" a deployment for a target environment. 614 KustomizeDeploy *KustomizeDeploy `yaml:"kustomize,omitempty"` 615 } 616 617 // KubectlDeploy *beta* uses a client side `kubectl apply` to deploy manifests. 618 // You'll need a `kubectl` CLI version installed that's compatible with your cluster. 619 type KubectlDeploy struct { 620 // Manifests lists the Kubernetes yaml or json manifests. 621 // Defaults to `["k8s/*.yaml"]`. 622 Manifests []string `yaml:"manifests,omitempty" skaffold:"filepath"` 623 624 // RemoteManifests lists Kubernetes manifests in remote clusters. 625 RemoteManifests []string `yaml:"remoteManifests,omitempty"` 626 627 // Flags are additional flags passed to `kubectl`. 628 Flags KubectlFlags `yaml:"flags,omitempty"` 629 630 // DefaultNamespace is the default namespace passed to kubectl on deployment if no other override is given. 631 DefaultNamespace *string `yaml:"defaultNamespace,omitempty"` 632 } 633 634 // KubectlFlags are additional flags passed on the command 635 // line to kubectl either on every command (Global), on creations (Apply) 636 // or deletions (Delete). 637 type KubectlFlags struct { 638 // Global are additional flags passed on every command. 639 Global []string `yaml:"global,omitempty"` 640 641 // Apply are additional flags passed on creations (`kubectl apply`). 642 Apply []string `yaml:"apply,omitempty"` 643 644 // Delete are additional flags passed on deletions (`kubectl delete`). 645 Delete []string `yaml:"delete,omitempty"` 646 647 // DisableValidation passes the `--validate=false` flag to supported 648 // `kubectl` commands when enabled. 649 DisableValidation bool `yaml:"disableValidation,omitempty"` 650 } 651 652 // KptDeploy *alpha* uses the `kpt` CLI to manage and deploy manifests. 653 type KptDeploy struct { 654 // Dir is the path to the config directory (Required). 655 // By default, the Dir contains the application configurations, 656 // [kustomize config files](https://kubectl.docs.kubernetes.io/pages/examples/kustomize.html) 657 // and [declarative kpt functions](https://googlecontainertools.github.io/kpt/guides/consumer/function/#declarative-run). 658 Dir string `yaml:"dir" yamltags:"required" skaffold:"filepath"` 659 660 // Fn adds additional configurations for `kpt fn`. 661 Fn KptFn `yaml:"fn,omitempty"` 662 663 // Live adds additional configurations for `kpt live`. 664 Live KptLive `yaml:"live,omitempty"` 665 } 666 667 // KptFn adds additional configurations used when calling `kpt fn`. 668 type KptFn struct { 669 // FnPath is the directory to discover the declarative kpt functions. 670 // If not provided, kpt deployer uses `kpt.Dir`. 671 FnPath string `yaml:"fnPath,omitempty" skaffold:"filepath"` 672 673 // Image is a kpt function image to run the configs imperatively. If provided, kpt.fn.fnPath 674 // will be ignored. 675 Image string `yaml:"image,omitempty"` 676 677 // NetworkName is the docker network name to run the kpt function containers (default "bridge"). 678 NetworkName string `yaml:"networkName,omitempty"` 679 680 // GlobalScope sets the global scope for the kpt functions. see `kpt help fn run`. 681 GlobalScope bool `yaml:"globalScope,omitempty"` 682 683 // Network enables network access for the kpt function containers. 684 Network bool `yaml:"network,omitempty"` 685 686 // Mount is a list of storage options to mount to the fn image. 687 Mount []string `yaml:"mount,omitempty"` 688 689 // SinkDir is the directory to where the manipulated resource output is stored. 690 SinkDir string `yaml:"sinkDir,omitempty" skaffold:"filepath"` 691 } 692 693 // KptLive adds additional configurations used when calling `kpt live`. 694 type KptLive struct { 695 // Apply sets the kpt inventory directory. 696 Apply KptApplyInventory `yaml:"apply,omitempty"` 697 698 // Options adds additional configurations for `kpt live apply` commands. 699 Options KptApplyOptions `yaml:"options,omitempty"` 700 } 701 702 // KptApplyInventory sets the kpt inventory directory. 703 type KptApplyInventory struct { 704 // Dir is equivalent to the dir in `kpt live apply <dir>`. If not provided, 705 // kpt deployer will create a hidden directory `.kpt-hydrated` to store the manipulated 706 // resource output and the kpt inventory-template.yaml file. 707 Dir string `yaml:"dir,omitempty"` 708 709 // InventoryID *alpha* is the identifier for a group of applied resources. 710 // This value is only needed when the `kpt live` is working on a pre-applied cluster resources. 711 InventoryID string `yaml:"inventoryID,omitempty"` 712 713 // InventoryNamespace *alpha* sets the inventory namespace. 714 InventoryNamespace string `yaml:"inventoryNamespace,omitempty"` 715 } 716 717 // KptApplyOptions adds additional configurations used when calling `kpt live apply`. 718 type KptApplyOptions struct { 719 // PollPeriod sets for the polling period for resource statuses. Default to 2s. 720 PollPeriod string `yaml:"pollPeriod,omitempty"` 721 722 // PrunePropagationPolicy sets the propagation policy for pruning. 723 // Possible settings are Background, Foreground, Orphan. 724 // Default to "Background". 725 PrunePropagationPolicy string `yaml:"prunePropagationPolicy,omitempty"` 726 727 // PruneTimeout sets the time threshold to wait for all pruned resources to be deleted. 728 PruneTimeout string `yaml:"pruneTimeout,omitempty"` 729 730 // ReconcileTimeout sets the time threshold to wait for all resources to reach the current status. 731 ReconcileTimeout string `yaml:"reconcileTimeout,omitempty"` 732 } 733 734 // LogsConfig configures how container logs are printed as a result of a deployment. 735 type LogsConfig struct { 736 // Prefix defines the prefix shown on each log line. Valid values are 737 // `container`: prefix logs lines with the name of the container. 738 // `podAndContainer`: prefix logs lines with the names of the pod and of the container. 739 // `auto`: same as `podAndContainer` except that the pod name is skipped if it's the same as the container name. 740 // `none`: don't add a prefix. 741 // Defaults to `auto`. 742 Prefix string `yaml:"prefix,omitempty"` 743 } 744 745 // Artifact are the items that need to be built, along with the context in which 746 // they should be built. 747 type Artifact struct { 748 // ImageName is the name of the image to be built. 749 // For example: `gcr.io/k8s-skaffold/example`. 750 ImageName string `yaml:"image,omitempty" yamltags:"required"` 751 752 // Workspace is the directory containing the artifact's sources. 753 // Defaults to `.`. 754 Workspace string `yaml:"context,omitempty" skaffold:"filepath"` 755 756 // Sync *beta* lists local files synced to pods instead 757 // of triggering an image build when modified. 758 // If no files are listed, sync all the files and infer the destination. 759 // Defaults to `infer: ["**/*"]`. 760 Sync *Sync `yaml:"sync,omitempty"` 761 762 // ArtifactType describes how to build an artifact. 763 ArtifactType `yaml:",inline"` 764 765 // Dependencies describes build artifacts that this artifact depends on. 766 Dependencies []*ArtifactDependency `yaml:"requires,omitempty"` 767 } 768 769 // Sync *beta* specifies what files to sync into the container. 770 // This is a list of sync rules indicating the intent to sync for source files. 771 // If no files are listed, sync all the files and infer the destination. 772 // Defaults to `infer: ["**/*"]`. 773 type Sync struct { 774 // Manual lists manual sync rules indicating the source and destination. 775 Manual []*SyncRule `yaml:"manual,omitempty" yamltags:"oneOf=sync"` 776 777 // Infer lists file patterns which may be synced into the container 778 // The container destination is inferred by the builder 779 // based on the instructions of a Dockerfile. 780 // Available for docker and kaniko artifacts and custom 781 // artifacts that declare dependencies on a dockerfile. 782 Infer []string `yaml:"infer,omitempty" yamltags:"oneOf=sync"` 783 784 // Auto delegates discovery of sync rules to the build system. 785 // Only available for jib and buildpacks. 786 Auto *bool `yaml:"auto,omitempty" yamltags:"oneOf=sync"` 787 } 788 789 // SyncRule specifies which local files to sync to remote folders. 790 type SyncRule struct { 791 // Src is a glob pattern to match local paths against. 792 // Directories should be delimited by `/` on all platforms. 793 // For example: `"css/**/*.css"`. 794 Src string `yaml:"src,omitempty" yamltags:"required"` 795 796 // Dest is the destination path in the container where the files should be synced to. 797 // For example: `"app/"` 798 Dest string `yaml:"dest,omitempty" yamltags:"required"` 799 800 // Strip specifies the path prefix to remove from the source path when 801 // transplanting the files into the destination folder. 802 // For example: `"css/"` 803 Strip string `yaml:"strip,omitempty"` 804 } 805 806 // Profile is used to override any `build`, `test` or `deploy` configuration. 807 type Profile struct { 808 // Name is a unique profile name. 809 // For example: `profile-prod`. 810 Name string `yaml:"name,omitempty" yamltags:"required"` 811 812 // Activation criteria by which a profile can be auto-activated. 813 // The profile is auto-activated if any one of the activations are triggered. 814 // An activation is triggered if all of the criteria (env, kubeContext, command) are triggered. 815 Activation []Activation `yaml:"activation,omitempty"` 816 817 // Patches lists patches applied to the configuration. 818 // Patches use the JSON patch notation. 819 Patches []JSONPatch `yaml:"patches,omitempty"` 820 821 // Pipeline contains the definitions to replace the default skaffold pipeline. 822 Pipeline `yaml:",inline"` 823 } 824 825 // JSONPatch patch to be applied by a profile. 826 type JSONPatch struct { 827 // Op is the operation carried by the patch: `add`, `remove`, `replace`, `move`, `copy` or `test`. 828 // Defaults to `replace`. 829 Op string `yaml:"op,omitempty"` 830 831 // Path is the position in the yaml where the operation takes place. 832 // For example, this targets the `dockerfile` of the first artifact built. 833 // For example: `/build/artifacts/0/docker/dockerfile`. 834 Path string `yaml:"path,omitempty" yamltags:"required"` 835 836 // From is the source position in the yaml, used for `copy` or `move` operations. 837 From string `yaml:"from,omitempty"` 838 839 // Value is the value to apply. Can be any portion of yaml. 840 Value *util.YamlpatchNode `yaml:"value,omitempty"` 841 } 842 843 // Activation criteria by which a profile is auto-activated. 844 type Activation struct { 845 // Env is a `key=pattern` pair. The profile is auto-activated if an Environment 846 // Variable `key` matches the pattern. If the pattern starts with `!`, activation 847 // happens if the remaining pattern is _not_ matched. The pattern matches if the 848 // Environment Variable value is exactly `pattern`, or the regex `pattern` is 849 // found in it. An empty `pattern` (e.g. `env: "key="`) always only matches if 850 // the Environment Variable is undefined or empty. 851 // For example: `ENV=production` 852 Env string `yaml:"env,omitempty"` 853 854 // KubeContext is a Kubernetes context for which the profile is auto-activated. 855 // For example: `minikube`. 856 KubeContext string `yaml:"kubeContext,omitempty"` 857 858 // Command is a Skaffold command for which the profile is auto-activated. 859 // For example: `dev`. 860 Command string `yaml:"command,omitempty"` 861 } 862 863 // ArtifactType describes how to build an artifact. 864 type ArtifactType struct { 865 // DockerArtifact *beta* describes an artifact built from a Dockerfile. 866 DockerArtifact *DockerArtifact `yaml:"docker,omitempty" yamltags:"oneOf=artifact"` 867 868 // BazelArtifact *beta* requires bazel CLI to be installed and the sources to 869 // contain [Bazel](https://bazel.build/) configuration files. 870 BazelArtifact *BazelArtifact `yaml:"bazel,omitempty" yamltags:"oneOf=artifact"` 871 872 // KoArtifact builds images using [ko](https://github.com/google/ko). 873 KoArtifact *KoArtifact `yaml:"ko,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 // Volumes support mounting host volumes into the container. 929 Volumes *[]BuildpackVolume `yaml:"volumes,omitempty"` 930 } 931 932 // BuildpackDependencies *alpha* is used to specify dependencies for an artifact built by buildpacks. 933 type BuildpackDependencies struct { 934 // 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. 935 Paths []string `yaml:"paths,omitempty" yamltags:"oneOf=dependency"` 936 937 // 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. 938 // Will only work in conjunction with `paths`. 939 Ignore []string `yaml:"ignore,omitempty"` 940 } 941 942 // BuildpackVolume *alpha* is used to mount host volumes or directories in the build container. 943 type BuildpackVolume struct { 944 // Host is the local volume or absolute directory of the path to mount. 945 Host string `yaml:"host" skaffold:"filepath" yamltags:"required"` 946 947 // Target is the path where the file or directory is available in the container. 948 // It is strongly recommended to not specify locations under `/cnb` or `/layers`. 949 Target string `yaml:"target" yamltags:"required"` 950 951 // Options specify a list of comma-separated mount options. 952 // Valid options are: 953 // `ro` (default): volume contents are read-only. 954 // `rw`: volume contents are readable and writable. 955 // `volume-opt=<key>=<value>`: can be specified more than once, takes a key-value pair. 956 Options string `yaml:"options,omitempty"` 957 } 958 959 // CustomArtifact *beta* describes an artifact built from a custom build script 960 // written by the user. It can be used to build images with builders that aren't directly integrated with skaffold. 961 type CustomArtifact struct { 962 // BuildCommand is the command executed to build the image. 963 BuildCommand string `yaml:"buildCommand,omitempty"` 964 // Dependencies are the file dependencies that skaffold should watch for both rebuilding and file syncing for this artifact. 965 Dependencies *CustomDependencies `yaml:"dependencies,omitempty"` 966 } 967 968 // CustomDependencies *beta* is used to specify dependencies for an artifact built by a custom build script. 969 // Either `dockerfile` or `paths` should be specified for file watching to work as expected. 970 type CustomDependencies struct { 971 // Dockerfile should be set if the artifact is built from a Dockerfile, from which skaffold can determine dependencies. 972 Dockerfile *DockerfileDependency `yaml:"dockerfile,omitempty" yamltags:"oneOf=dependency"` 973 974 // Command represents a custom command that skaffold executes to obtain dependencies. The output of this command *must* be a valid JSON array. 975 Command string `yaml:"command,omitempty" yamltags:"oneOf=dependency"` 976 977 // 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. 978 Paths []string `yaml:"paths,omitempty" yamltags:"oneOf=dependency"` 979 980 // 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. 981 // Will only work in conjunction with `paths`. 982 Ignore []string `yaml:"ignore,omitempty"` 983 } 984 985 // CustomTest describes the custom test command provided by the user. 986 // Custom tests are run after an image build whenever build or test dependencies are changed. 987 type CustomTest struct { 988 // Command is the custom command to be executed. If the command exits with a non-zero return 989 // code, the test will be considered to have failed. 990 Command string `yaml:"command" yamltags:"required"` 991 992 // TimeoutSeconds sets the wait time for skaffold for the command to complete. 993 // If unset or 0, Skaffold will wait until the command completes. 994 TimeoutSeconds int `yaml:"timeoutSeconds,omitempty"` 995 996 // Dependencies are additional test-specific file dependencies; changes to these files will re-run this test. 997 Dependencies *CustomTestDependencies `yaml:"dependencies,omitempty"` 998 } 999 1000 // CustomTestDependencies is used to specify dependencies for custom test command. 1001 // `paths` should be specified for file watching to work as expected. 1002 type CustomTestDependencies struct { 1003 // Command represents a command that skaffold executes to obtain dependencies. The output of this command *must* be a valid JSON array. 1004 Command string `yaml:"command,omitempty" yamltags:"oneOf=dependency"` 1005 1006 // Paths locates the file dependencies for the command relative to workspace. 1007 // Paths should be set to the file dependencies for this command, so that the skaffold file watcher knows when to retest and perform file synchronization. 1008 // For example: `["src/test/**"]` 1009 Paths []string `yaml:"paths,omitempty" yamltags:"oneOf=dependency"` 1010 1011 // 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 retest and file synchronization. 1012 // Will only work in conjunction with `paths`. 1013 Ignore []string `yaml:"ignore,omitempty"` 1014 } 1015 1016 // 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. 1017 type DockerfileDependency struct { 1018 // Path locates the Dockerfile relative to workspace. 1019 Path string `yaml:"path,omitempty"` 1020 1021 // BuildArgs are key/value pairs used to resolve values of `ARG` instructions in a Dockerfile. 1022 // Values can be constants or environment variables via the go template syntax. 1023 // For example: `{"key1": "value1", "key2": "value2", "key3": "'{{.ENV_VARIABLE}}'"}`. 1024 BuildArgs map[string]*string `yaml:"buildArgs,omitempty"` 1025 } 1026 1027 // KanikoArtifact describes an artifact built from a Dockerfile, 1028 // with kaniko. 1029 type KanikoArtifact struct { 1030 1031 // Cleanup to clean the filesystem at the end of the build. 1032 Cleanup bool `yaml:"cleanup,omitempty"` 1033 1034 // Insecure if you want to push images to a plain HTTP registry. 1035 Insecure bool `yaml:"insecure,omitempty"` 1036 1037 // InsecurePull if you want to pull images from a plain HTTP registry. 1038 InsecurePull bool `yaml:"insecurePull,omitempty"` 1039 1040 // NoPush if you only want to build the image, without pushing to a registry. 1041 NoPush bool `yaml:"noPush,omitempty"` 1042 1043 // Force building outside of a container. 1044 Force bool `yaml:"force,omitempty"` 1045 1046 // LogTimestamp to add timestamps to log format. 1047 LogTimestamp bool `yaml:"logTimestamp,omitempty"` 1048 1049 // Reproducible is used to strip timestamps out of the built image. 1050 Reproducible bool `yaml:"reproducible,omitempty"` 1051 1052 // SingleSnapshot is takes a single snapshot of the filesystem at the end of the build. 1053 // So only one layer will be appended to the base image. 1054 SingleSnapshot bool `yaml:"singleSnapshot,omitempty"` 1055 1056 // SkipTLS skips TLS certificate validation when pushing to a registry. 1057 SkipTLS bool `yaml:"skipTLS,omitempty"` 1058 1059 // SkipTLSVerifyPull skips TLS certificate validation when pulling from a registry. 1060 SkipTLSVerifyPull bool `yaml:"skipTLSVerifyPull,omitempty"` 1061 1062 // SkipUnusedStages builds only used stages if defined to true. 1063 // Otherwise it builds by default all stages, even the unnecessaries ones until it reaches the target stage / end of Dockerfile. 1064 SkipUnusedStages bool `yaml:"skipUnusedStages,omitempty"` 1065 1066 // UseNewRun to Use the experimental run implementation for detecting changes without requiring file system snapshots. 1067 // In some cases, this may improve build performance by 75%. 1068 UseNewRun bool `yaml:"useNewRun,omitempty"` 1069 1070 // WhitelistVarRun is used to ignore `/var/run` when taking image snapshot. 1071 // Set it to false to preserve /var/run/* in destination image. 1072 WhitelistVarRun bool `yaml:"whitelistVarRun,omitempty"` 1073 1074 // DockerfilePath locates the Dockerfile relative to workspace. 1075 // Defaults to `Dockerfile`. 1076 DockerfilePath string `yaml:"dockerfile,omitempty"` 1077 1078 // Target is to indicate which build stage is the target build stage. 1079 Target string `yaml:"target,omitempty"` 1080 1081 // InitImage is the image used to run init container which mounts kaniko context. 1082 InitImage string `yaml:"initImage,omitempty"` 1083 1084 // Image is the Docker image used by the Kaniko pod. 1085 // Defaults to the latest released version of `gcr.io/kaniko-project/executor`. 1086 Image string `yaml:"image,omitempty"` 1087 1088 // DigestFile to specify a file in the container. This file will receive the digest of a built image. 1089 // This can be used to automatically track the exact image built by kaniko. 1090 DigestFile string `yaml:"digestFile,omitempty"` 1091 1092 // ImageNameWithDigestFile specify a file to save the image name with digest of the built image to. 1093 ImageNameWithDigestFile string `yaml:"imageNameWithDigestFile,omitempty"` 1094 1095 // LogFormat <text|color|json> to set the log format. 1096 LogFormat string `yaml:"logFormat,omitempty"` 1097 1098 // OCILayoutPath is to specify a directory in the container where the OCI image layout of a built image will be placed. 1099 // This can be used to automatically track the exact image built by kaniko. 1100 OCILayoutPath string `yaml:"ociLayoutPath,omitempty"` 1101 1102 // RegistryMirror if you want to use a registry mirror instead of default `index.docker.io`. 1103 RegistryMirror string `yaml:"registryMirror,omitempty"` 1104 1105 // SnapshotMode is how Kaniko will snapshot the filesystem. 1106 SnapshotMode string `yaml:"snapshotMode,omitempty"` 1107 1108 // TarPath is path to save the image as a tarball at path instead of pushing the image. 1109 TarPath string `yaml:"tarPath,omitempty"` 1110 1111 // Verbosity <panic|fatal|error|warn|info|debug|trace> to set the logging level. 1112 Verbosity string `yaml:"verbosity,omitempty"` 1113 1114 // InsecureRegistry is to use plain HTTP requests when accessing a registry. 1115 InsecureRegistry []string `yaml:"insecureRegistry,omitempty"` 1116 1117 // SkipTLSVerifyRegistry skips TLS certificate validation when accessing a registry. 1118 SkipTLSVerifyRegistry []string `yaml:"skipTLSVerifyRegistry,omitempty"` 1119 1120 // Env are environment variables passed to the kaniko pod. 1121 // It also accepts environment variables via the go template syntax. 1122 // For example: `[{"name": "key1", "value": "value1"}, {"name": "key2", "value": "value2"}, {"name": "key3", "value": "'{{.ENV_VARIABLE}}'"}]`. 1123 Env []v1.EnvVar `yaml:"env,omitempty"` 1124 1125 // Cache configures Kaniko caching. If a cache is specified, Kaniko will 1126 // use a remote cache which will speed up builds. 1127 Cache *KanikoCache `yaml:"cache,omitempty"` 1128 1129 // RegistryCertificate is to provide a certificate for TLS communication with a given registry. 1130 // my.registry.url: /path/to/the/certificate.cert is the expected format. 1131 RegistryCertificate map[string]*string `yaml:"registryCertificate,omitempty"` 1132 1133 // Label key: value to set some metadata to the final image. 1134 // This is equivalent as using the LABEL within the Dockerfile. 1135 Label map[string]*string `yaml:"label,omitempty"` 1136 1137 // BuildArgs are arguments passed to the docker build. 1138 // It also accepts environment variables and generated values via the go template syntax. 1139 // Exposed generated values: IMAGE_REPO, IMAGE_NAME, IMAGE_TAG. 1140 // For example: `{"key1": "value1", "key2": "value2", "key3": "'{{.ENV_VARIABLE}}'"}`. 1141 BuildArgs map[string]*string `yaml:"buildArgs,omitempty"` 1142 1143 // VolumeMounts are volume mounts passed to kaniko pod. 1144 VolumeMounts []v1.VolumeMount `yaml:"volumeMounts,omitempty"` 1145 } 1146 1147 // DockerArtifact describes an artifact built from a Dockerfile, 1148 // usually using `docker build`. 1149 type DockerArtifact struct { 1150 // DockerfilePath locates the Dockerfile relative to workspace. 1151 // Defaults to `Dockerfile`. 1152 DockerfilePath string `yaml:"dockerfile,omitempty"` 1153 1154 // Target is the Dockerfile target name to build. 1155 Target string `yaml:"target,omitempty"` 1156 1157 // BuildArgs are arguments passed to the docker build. 1158 // For example: `{"key1": "value1", "key2": "{{ .ENV_VAR }}"}`. 1159 BuildArgs map[string]*string `yaml:"buildArgs,omitempty"` 1160 1161 // NetworkMode is passed through to docker and overrides the 1162 // network configuration of docker builder. If unset, use whatever 1163 // is configured in the underlying docker daemon. Valid modes are 1164 // `host`: use the host's networking stack. 1165 // `bridge`: use the bridged network configuration. 1166 // `container:<name|id>`: reuse another container's network stack. 1167 // `none`: no networking in the container. 1168 NetworkMode string `yaml:"network,omitempty"` 1169 1170 // AddHost lists add host. 1171 // For example: `["host1:ip1", "host2:ip2"]`. 1172 AddHost []string `yaml:"addHost,omitempty"` 1173 1174 // CacheFrom lists the Docker images used as cache sources. 1175 // For example: `["golang:1.10.1-alpine3.7", "alpine:3.7"]`. 1176 CacheFrom []string `yaml:"cacheFrom,omitempty"` 1177 1178 // NoCache used to pass in --no-cache to docker build to prevent caching. 1179 NoCache bool `yaml:"noCache,omitempty"` 1180 1181 // Squash is used to pass in --squash to docker build to squash docker image layers into single layer. 1182 Squash bool `yaml:"squash,omitempty"` 1183 1184 // Secret contains information about a local secret passed to `docker build`, 1185 // along with optional destination information. 1186 Secret *DockerSecret `yaml:"secret,omitempty"` 1187 1188 // SSH is used to pass in --ssh to docker build to use SSH agent. Format is "default|<id>[=<socket>|<key>[,<key>]]". 1189 SSH string `yaml:"ssh,omitempty"` 1190 } 1191 1192 // DockerSecret contains information about a local secret passed to `docker build`, 1193 // along with optional destination information. 1194 type DockerSecret struct { 1195 // ID is the id of the secret. 1196 ID string `yaml:"id,omitempty" yamltags:"required"` 1197 1198 // Source is the path to the secret on the host machine. 1199 Source string `yaml:"src,omitempty"` 1200 } 1201 1202 // BazelArtifact describes an artifact built with [Bazel](https://bazel.build/). 1203 type BazelArtifact struct { 1204 // BuildTarget is the `bazel build` target to run. 1205 // For example: `//:skaffold_example.tar`. 1206 BuildTarget string `yaml:"target,omitempty" yamltags:"required"` 1207 1208 // BuildArgs are additional args to pass to `bazel build`. 1209 // For example: `["-flag", "--otherflag"]`. 1210 BuildArgs []string `yaml:"args,omitempty"` 1211 } 1212 1213 // KoArtifact builds images using [ko](https://github.com/google/ko). 1214 type KoArtifact struct { 1215 // BaseImage overrides the default ko base image (`gcr.io/distroless/static:nonroot`). 1216 // Corresponds to, and overrides, the `defaultBaseImage` in `.ko.yaml`. 1217 BaseImage string `yaml:"fromImage,omitempty"` 1218 1219 // Dependencies are the file dependencies that Skaffold should watch for both rebuilding and file syncing for this artifact. 1220 Dependencies *KoDependencies `yaml:"dependencies,omitempty"` 1221 1222 // Dir is the directory where the `go` tool will be run. 1223 // The value is a directory path relative to the `context` directory. 1224 // If empty, the `go` tool will run in the `context` directory. 1225 // Example: `./my-app-sources`. 1226 Dir string `yaml:"dir,omitempty"` 1227 1228 // Env are environment variables, in the `key=value` form, passed to the build. 1229 // These environment variables are only used at build time. 1230 // They are _not_ set in the resulting container image. 1231 // For example: `["GOPRIVATE=source.developers.google.com", "GOCACHE=/workspace/.gocache"]`. 1232 Env []string `yaml:"env,omitempty"` 1233 1234 // Flags are additional build flags passed to `go build`. 1235 // For example: `["-trimpath", "-v"]`. 1236 Flags []string `yaml:"flags,omitempty"` 1237 1238 // Labels are key-value string pairs to add to the image config. 1239 // For example: `{"org.opencontainers.image.source":"https://github.com/GoogleContainerTools/skaffold"}`. 1240 Labels map[string]string `yaml:"labels,omitempty"` 1241 1242 // Ldflags are linker flags passed to the builder. 1243 // For example: `["-buildid=", "-s", "-w"]`. 1244 Ldflags []string `yaml:"ldflags,omitempty"` 1245 1246 // Main is the location of the main package. It is the pattern passed to `go build`. 1247 // If main is specified as a relative path, it is relative to the `context` directory. 1248 // If main is empty, the ko builder uses a default value of `.`. 1249 // If main is a pattern with wildcards, such as `./...`, the expansion must contain only one main package, otherwise ko fails. 1250 // Main is ignored if the `ImageName` starts with `ko://`. 1251 // Example: `./cmd/foo`. 1252 Main string `yaml:"main,omitempty"` 1253 1254 // Platforms is the list of platforms to build images for. 1255 // Each platform is of the format `os[/arch[/variant]]`, e.g., `linux/amd64`. 1256 // Use `["all"]` to build for all platforms supported by the base image. 1257 // If empty, the builder uses the ko default (`["linux/amd64"]`). 1258 // Example: `["linux/amd64", "linux/arm64"]`. 1259 Platforms []string `yaml:"platforms,omitempty"` 1260 } 1261 1262 // KoDependencies is used to specify dependencies for an artifact built by ko. 1263 type KoDependencies struct { 1264 // 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. 1265 // Defaults to `["**/*.go"]`. 1266 Paths []string `yaml:"paths,omitempty" yamltags:"oneOf=dependency"` 1267 1268 // Ignore specifies the paths that should be ignored by Skaffold's file watcher. 1269 // If a file exists in both `paths` and in `ignore`, it will be ignored, and will be excluded from both rebuilds and file synchronization. 1270 Ignore []string `yaml:"ignore,omitempty"` 1271 } 1272 1273 // JibArtifact builds images using the 1274 // [Jib plugins for Maven and Gradle](https://github.com/GoogleContainerTools/jib/). 1275 type JibArtifact struct { 1276 // Project selects which sub-project to build for multi-module builds. 1277 Project string `yaml:"project,omitempty"` 1278 1279 // Flags are additional build flags passed to the builder. 1280 // For example: `["--no-build-cache"]`. 1281 Flags []string `yaml:"args,omitempty"` 1282 1283 // Type the Jib builder type; normally determined automatically. Valid types are 1284 // `maven`: for Maven. 1285 // `gradle`: for Gradle. 1286 Type string `yaml:"type,omitempty"` 1287 1288 // BaseImage overrides the configured jib base image. 1289 BaseImage string `yaml:"fromImage,omitempty"` 1290 } 1291 1292 // UnmarshalYAML provides a custom unmarshaller to deal with 1293 // https://github.com/GoogleContainerTools/skaffold/issues/4175 1294 func (clusterDetails *ClusterDetails) UnmarshalYAML(value *yaml.Node) error { 1295 // We do this as follows 1296 // 1. We zero out the fields in the node that require custom processing 1297 // 2. We unmarshal all the non special fields using the aliased type resource 1298 // we use an alias type to avoid recursion caused by invoking this function infinitely 1299 // 3. We deserialize the special fields as required. 1300 type ClusterDetailsForUnmarshaling ClusterDetails 1301 1302 volumes, remaining, err := util.UnmarshalClusterVolumes(value) 1303 1304 if err != nil { 1305 return err 1306 } 1307 1308 // Unmarshal the remaining values 1309 aux := (*ClusterDetailsForUnmarshaling)(clusterDetails) 1310 err = yaml.Unmarshal(remaining, aux) 1311 1312 if err != nil { 1313 return err 1314 } 1315 1316 clusterDetails.Volumes = volumes 1317 return nil 1318 } 1319 1320 // UnmarshalYAML provides a custom unmarshaller to deal with 1321 // https://github.com/GoogleContainerTools/skaffold/issues/4175 1322 func (ka *KanikoArtifact) UnmarshalYAML(value *yaml.Node) error { 1323 // We do this as follows 1324 // 1. We zero out the fields in the node that require custom processing 1325 // 2. We unmarshal all the non special fields using the aliased type resource 1326 // we use an alias type to avoid recursion caused by invoking this function infinitely 1327 // 3. We deserialize the special fields as required. 1328 type KanikoArtifactForUnmarshaling KanikoArtifact 1329 1330 mounts, remaining, err := util.UnmarshalKanikoArtifact(value) 1331 1332 if err != nil { 1333 return err 1334 } 1335 1336 // Unmarshal the remaining values 1337 aux := (*KanikoArtifactForUnmarshaling)(ka) 1338 err = yaml.Unmarshal(remaining, aux) 1339 1340 if err != nil { 1341 return err 1342 } 1343 1344 ka.VolumeMounts = mounts 1345 return nil 1346 } 1347 1348 // MarshalYAML provides a custom marshaller to deal with 1349 // https://github.com/GoogleContainerTools/skaffold/issues/4175 1350 func (clusterDetails *ClusterDetails) MarshalYAML() (interface{}, error) { 1351 // We do this as follows 1352 // 1. We zero out the fields in the node that require custom processing 1353 // 2. We marshall all the non special fields using the aliased type resource 1354 // we use an alias type to avoid recursion caused by invoking this function infinitely 1355 // 3. We unmarshal to a map 1356 // 4. We marshal the special fields to json and unmarshal to a map 1357 // * This leverages the json struct annotations to marshal as expected 1358 // 5. We combine the two maps and return 1359 type ClusterDetailsForUnmarshaling ClusterDetails 1360 1361 // Marshal volumes to a list. Use json because the Kubernetes resources have json annotations. 1362 volumes := clusterDetails.Volumes 1363 1364 j, err := json.Marshal(volumes) 1365 1366 if err != nil { 1367 return err, nil 1368 } 1369 1370 vList := []interface{}{} 1371 1372 if err := json.Unmarshal(j, &vList); err != nil { 1373 return nil, err 1374 } 1375 1376 // Make a deep copy of clusterDetails because we need to zero out volumes and we don't want to modify the 1377 // current object. 1378 aux := &ClusterDetailsForUnmarshaling{} 1379 1380 b, err := json.Marshal(clusterDetails) 1381 1382 if err != nil { 1383 return nil, err 1384 } 1385 1386 if err := json.Unmarshal(b, aux); err != nil { 1387 return nil, err 1388 } 1389 1390 aux.Volumes = nil 1391 1392 marshaled, err := yaml.Marshal(aux) 1393 1394 if err != nil { 1395 return nil, err 1396 } 1397 1398 m := map[string]interface{}{} 1399 1400 err = yaml.Unmarshal(marshaled, m) 1401 1402 if len(vList) > 0 { 1403 m["volumes"] = vList 1404 } 1405 return m, err 1406 } 1407 1408 // MarshalYAML provides a custom marshaller to deal with 1409 // https://github.com/GoogleContainerTools/skaffold/issues/4175 1410 func (ka *KanikoArtifact) MarshalYAML() (interface{}, error) { 1411 // We do this as follows 1412 // 1. We zero out the fields in the node that require custom processing 1413 // 2. We marshal all the non special fields using the aliased type resource 1414 // we use an alias type to avoid recursion caused by invoking this function infinitely 1415 // 3. We unmarshal to a map 1416 // 4. We marshal the special fields to json and unmarshal to a map 1417 // * This leverages the json struct annotations to marshal as expected 1418 // 5. We combine the two maps and return 1419 type KanikoArtifactForUnmarshaling KanikoArtifact 1420 1421 // Marshal volumes to a map. User json because the Kubernetes resources have json annotations. 1422 volumeMounts := ka.VolumeMounts 1423 1424 j, err := json.Marshal(volumeMounts) 1425 1426 if err != nil { 1427 return err, nil 1428 } 1429 1430 vList := []interface{}{} 1431 1432 if err := json.Unmarshal(j, &vList); err != nil { 1433 return nil, err 1434 } 1435 1436 // Make a deep copy of kanikoArtifact because we need to zero out volumeMounts and we don't want to modify the 1437 // current object. 1438 aux := &KanikoArtifactForUnmarshaling{} 1439 1440 b, err := json.Marshal(ka) 1441 1442 if err != nil { 1443 return nil, err 1444 } 1445 1446 if err := json.Unmarshal(b, aux); err != nil { 1447 return nil, err 1448 } 1449 aux.VolumeMounts = nil 1450 1451 marshaled, err := yaml.Marshal(aux) 1452 1453 if err != nil { 1454 return nil, err 1455 } 1456 1457 m := map[string]interface{}{} 1458 1459 err = yaml.Unmarshal(marshaled, m) 1460 1461 if len(vList) > 0 { 1462 m["volumeMounts"] = vList 1463 } 1464 return m, err 1465 } 1466 1467 // TODO (yuwenma): HelmDeploy and KustomizeDeploy shall be deprecated. 1468 1469 // HelmDeploy *beta* uses the `helm` CLI to apply the charts to the cluster. 1470 type HelmDeploy struct { 1471 // Releases is a list of Helm releases. 1472 Releases []HelmRelease `yaml:"releases,omitempty" yamltags:"required"` 1473 1474 // Flags are additional option flags that are passed on the command 1475 // line to `helm`. 1476 Flags HelmDeployFlags `yaml:"flags,omitempty"` 1477 } 1478 1479 // HelmDeployFlags are additional option flags that are passed on the command 1480 // line to `helm`. 1481 type HelmDeployFlags struct { 1482 // Global are additional flags passed on every command. 1483 Global []string `yaml:"global,omitempty"` 1484 1485 // Install are additional flags passed to (`helm install`). 1486 Install []string `yaml:"install,omitempty"` 1487 1488 // Upgrade are additional flags passed to (`helm upgrade`). 1489 Upgrade []string `yaml:"upgrade,omitempty"` 1490 } 1491 1492 // KustomizeDeploy *beta* uses the `kustomize` CLI to "patch" a deployment for a target environment. 1493 type KustomizeDeploy struct { 1494 // KustomizePaths is the path to Kustomization files. 1495 // Defaults to `["."]`. 1496 KustomizePaths []string `yaml:"paths,omitempty" skaffold:"filepath"` 1497 1498 // Flags are additional flags passed to `kubectl`. 1499 Flags KubectlFlags `yaml:"flags,omitempty"` 1500 1501 // BuildArgs are additional args passed to `kustomize build`. 1502 BuildArgs []string `yaml:"buildArgs,omitempty"` 1503 1504 // DefaultNamespace is the default namespace passed to kubectl on deployment if no other override is given. 1505 DefaultNamespace *string `yaml:"defaultNamespace,omitempty"` 1506 } 1507 1508 // HelmRelease describes a helm release to be deployed. 1509 type HelmRelease struct { 1510 // Name is the name of the Helm release. 1511 // It accepts environment variables via the go template syntax. 1512 Name string `yaml:"name,omitempty" yamltags:"required"` 1513 1514 // ChartPath is the local path to a packaged Helm chart or an unpacked Helm chart directory. 1515 ChartPath string `yaml:"chartPath,omitempty" yamltags:"oneOf=chartSource" skaffold:"filepath"` 1516 1517 // RemoteChart refers to a remote Helm chart reference or URL. 1518 RemoteChart string `yaml:"remoteChart,omitempty" yamltags:"oneOf=chartSource"` 1519 1520 // ValuesFiles are the paths to the Helm `values` files. 1521 ValuesFiles []string `yaml:"valuesFiles,omitempty" skaffold:"filepath"` 1522 1523 // ArtifactOverrides are key value pairs where the 1524 // key represents the parameter used in the `--set-string` Helm CLI flag to define a container 1525 // image and the value corresponds to artifact i.e. `ImageName` defined in `Build.Artifacts` section. 1526 // The resulting command-line is controlled by `ImageStrategy`. 1527 ArtifactOverrides util.FlatMap `yaml:"artifactOverrides,omitempty"` 1528 1529 // Namespace is the Kubernetes namespace. 1530 Namespace string `yaml:"namespace,omitempty"` 1531 1532 // Version is the version of the chart. 1533 Version string `yaml:"version,omitempty"` 1534 1535 // SetValues are key-value pairs. 1536 // If present, Skaffold will send `--set` flag to Helm CLI and append all pairs after the flag. 1537 SetValues util.FlatMap `yaml:"setValues,omitempty"` 1538 1539 // SetValueTemplates are key-value pairs. 1540 // If present, Skaffold will try to parse the value part of each key-value pair using 1541 // environment variables in the system, then send `--set` flag to Helm CLI and append 1542 // all parsed pairs after the flag. 1543 SetValueTemplates util.FlatMap `yaml:"setValueTemplates,omitempty"` 1544 1545 // SetFiles are key-value pairs. 1546 // If present, Skaffold will send `--set-file` flag to Helm CLI and append all pairs after the flag. 1547 SetFiles map[string]string `yaml:"setFiles,omitempty" skaffold:"filepath"` 1548 1549 // CreateNamespace if `true`, Skaffold will send `--create-namespace` flag to Helm CLI. 1550 // `--create-namespace` flag is available in Helm since version 3.2. 1551 // Defaults is `false`. 1552 CreateNamespace *bool `yaml:"createNamespace,omitempty"` 1553 1554 // Wait if `true`, Skaffold will send `--wait` flag to Helm CLI. 1555 // Defaults to `false`. 1556 Wait bool `yaml:"wait,omitempty"` 1557 1558 // RecreatePods if `true`, Skaffold will send `--recreate-pods` flag to Helm CLI 1559 // when upgrading a new version of a chart in subsequent dev loop deploy. 1560 // Defaults to `false`. 1561 RecreatePods bool `yaml:"recreatePods,omitempty"` 1562 1563 // SkipBuildDependencies should build dependencies be skipped. 1564 // Ignored for `remoteChart`. 1565 SkipBuildDependencies bool `yaml:"skipBuildDependencies,omitempty"` 1566 1567 // UseHelmSecrets instructs skaffold to use secrets plugin on deployment. 1568 UseHelmSecrets bool `yaml:"useHelmSecrets,omitempty"` 1569 1570 // Repo specifies the helm repository for remote charts. 1571 // If present, Skaffold will send `--repo` Helm CLI flag or flags. 1572 Repo string `yaml:"repo,omitempty"` 1573 1574 // UpgradeOnChange specifies whether to upgrade helm chart on code changes. 1575 // Default is `true` when helm chart is local (has `chartPath`). 1576 // Default is `false` when helm chart is remote (has `remoteChart`). 1577 UpgradeOnChange *bool `yaml:"upgradeOnChange,omitempty"` 1578 1579 // Overrides are key-value pairs. 1580 // If present, Skaffold will build a Helm `values` file that overrides 1581 // the original and use it to call Helm CLI (`--f` flag). 1582 Overrides util.HelmOverrides `yaml:"overrides,omitempty"` 1583 1584 // Packaged parameters for packaging helm chart (`helm package`). 1585 Packaged *HelmPackaged `yaml:"packaged,omitempty"` 1586 1587 // ImageStrategy controls how an `ArtifactOverrides` entry is 1588 // turned into `--set-string` Helm CLI flag or flags. 1589 ImageStrategy HelmImageStrategy `yaml:"imageStrategy,omitempty"` 1590 } 1591 1592 // HelmPackaged parameters for packaging helm chart (`helm package`). 1593 type HelmPackaged struct { 1594 // Version sets the `version` on the chart to this semver version. 1595 Version string `yaml:"version,omitempty"` 1596 1597 // AppVersion sets the `appVersion` on the chart to this version. 1598 AppVersion string `yaml:"appVersion,omitempty"` 1599 } 1600 1601 // HelmImageStrategy adds image configurations to the Helm `values` file. 1602 type HelmImageStrategy struct { 1603 HelmImageConfig `yaml:",inline"` 1604 } 1605 1606 // HelmImageConfig describes an image configuration. 1607 type HelmImageConfig struct { 1608 // HelmFQNConfig is the image configuration uses the syntax `IMAGE-NAME=IMAGE-REPOSITORY:IMAGE-TAG`. 1609 HelmFQNConfig *HelmFQNConfig `yaml:"fqn,omitempty" yamltags:"oneOf=helmImageStrategy"` 1610 1611 // HelmConventionConfig is the image configuration uses the syntax `IMAGE-NAME.repository=IMAGE-REPOSITORY, IMAGE-NAME.tag=IMAGE-TAG`. 1612 HelmConventionConfig *HelmConventionConfig `yaml:"helm,omitempty" yamltags:"oneOf=helmImageStrategy"` 1613 } 1614 1615 // HelmFQNConfig is the image config to use the FullyQualifiedImageName as param to set. 1616 type HelmFQNConfig struct { 1617 // Property defines the image config. 1618 Property string `yaml:"property,omitempty"` 1619 } 1620 1621 // HelmConventionConfig is the image config in the syntax of image.repository and image.tag. 1622 type HelmConventionConfig struct { 1623 // ExplicitRegistry separates `image.registry` to the image config syntax. Useful for some charts e.g. `postgresql`. 1624 ExplicitRegistry bool `yaml:"explicitRegistry,omitempty"` 1625 }