github.com/GoogleContainerTools/skaffold@v1.39.18/pkg/skaffold/schema/v1/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 v1
    18  
    19  import (
    20  	"github.com/GoogleContainerTools/skaffold/pkg/skaffold/schema/util"
    21  )
    22  
    23  // !!! WARNING !!! This config version is already released, please DO NOT MODIFY the structs in this file.
    24  const Version string = "skaffold/v1"
    25  
    26  // NewSkaffoldConfig creates a SkaffoldConfig
    27  func NewSkaffoldConfig() util.VersionedConfig {
    28  	return new(SkaffoldConfig)
    29  }
    30  
    31  // SkaffoldConfig holds the fields parsed from the Skaffold configuration file (skaffold.yaml).
    32  type SkaffoldConfig struct {
    33  	// APIVersion is the version of the configuration.
    34  	APIVersion string `yaml:"apiVersion" yamltags:"required"`
    35  
    36  	// Kind is always `Config`. Defaults to `Config`.
    37  	Kind string `yaml:"kind" yamltags:"required"`
    38  
    39  	// Metadata holds additional information about the config.
    40  	Metadata Metadata `yaml:"metadata,omitempty"`
    41  
    42  	// Pipeline defines the Build/Test/Deploy phases.
    43  	Pipeline `yaml:",inline"`
    44  
    45  	// Profiles *beta* can override be used to `build`, `test` or `deploy` configuration.
    46  	Profiles []Profile `yaml:"profiles,omitempty"`
    47  }
    48  
    49  // Metadata holds an optional name of the project.
    50  type Metadata struct {
    51  	// Name is an identifier for the project.
    52  	Name string `yaml:"name,omitempty"`
    53  }
    54  
    55  // Pipeline describes a Skaffold pipeline.
    56  type Pipeline struct {
    57  	// Build describes how images are built.
    58  	Build BuildConfig `yaml:"build,omitempty"`
    59  
    60  	// Test describes how images are tested.
    61  	Test []*TestCase `yaml:"test,omitempty"`
    62  
    63  	// Deploy describes how images are deployed.
    64  	Deploy DeployConfig `yaml:"deploy,omitempty"`
    65  
    66  	// PortForward describes user defined resources to port-forward.
    67  	PortForward []*PortForwardResource `yaml:"portForward,omitempty"`
    68  }
    69  
    70  func (c *SkaffoldConfig) GetVersion() string {
    71  	return c.APIVersion
    72  }
    73  
    74  // ResourceType describes the Kubernetes resource types used for port forwarding.
    75  type ResourceType string
    76  
    77  // PortForwardResource describes a resource to port forward.
    78  type PortForwardResource struct {
    79  	// Type is the Kubernetes type that should be port forwarded.
    80  	// Acceptable resource types include: `Service`, `Pod` and Controller resource type that has a pod spec: `ReplicaSet`, `ReplicationController`, `Deployment`, `StatefulSet`, `DaemonSet`, `Job`, `CronJob`.
    81  	Type ResourceType `yaml:"resourceType,omitempty"`
    82  
    83  	// Name is the name of the Kubernetes resource to port forward.
    84  	Name string `yaml:"resourceName,omitempty"`
    85  
    86  	// Namespace is the namespace of the resource to port forward.
    87  	Namespace string `yaml:"namespace,omitempty"`
    88  
    89  	// Port is the resource port that will be forwarded.
    90  	Port int `yaml:"port,omitempty"`
    91  
    92  	// LocalPort is the local port to forward to. If the port is unavailable, Skaffold will choose a random open port to forward to. *Optional*.
    93  	LocalPort int `yaml:"localPort,omitempty"`
    94  }
    95  
    96  // BuildConfig contains all the configuration for the build steps.
    97  type BuildConfig struct {
    98  	// Artifacts lists the images you're going to be building.
    99  	Artifacts []*Artifact `yaml:"artifacts,omitempty"`
   100  
   101  	// InsecureRegistries is a list of registries declared by the user to be insecure.
   102  	// These registries will be connected to via HTTP instead of HTTPS.
   103  	InsecureRegistries []string `yaml:"insecureRegistries,omitempty"`
   104  
   105  	// TagPolicy *beta* determines how images are tagged.
   106  	// A few strategies are provided here, although you most likely won't need to care!
   107  	// If not specified, it defaults to `gitCommit: {variant: Tags}`.
   108  	TagPolicy TagPolicy `yaml:"tagPolicy,omitempty"`
   109  
   110  	BuildType `yaml:",inline"`
   111  }
   112  
   113  // TagPolicy contains all the configuration for the tagging step.
   114  type TagPolicy struct {
   115  	// GitTagger *beta* tags images with the git tag or commit of the artifact's workspace.
   116  	GitTagger *GitTagger `yaml:"gitCommit,omitempty" yamltags:"oneOf=tag"`
   117  
   118  	// ShaTagger *beta* tags images with their sha256 digest.
   119  	ShaTagger *ShaTagger `yaml:"sha256,omitempty" yamltags:"oneOf=tag"`
   120  
   121  	// EnvTemplateTagger *beta* tags images with a configurable template string.
   122  	EnvTemplateTagger *EnvTemplateTagger `yaml:"envTemplate,omitempty" yamltags:"oneOf=tag"`
   123  
   124  	// DateTimeTagger *beta* tags images with the build timestamp.
   125  	DateTimeTagger *DateTimeTagger `yaml:"dateTime,omitempty" yamltags:"oneOf=tag"`
   126  }
   127  
   128  // ShaTagger *beta* tags images with their sha256 digest.
   129  type ShaTagger struct{}
   130  
   131  // GitTagger *beta* tags images with the git tag or commit of the artifact's workspace.
   132  type GitTagger struct {
   133  	// Variant determines the behavior of the git tagger. Valid variants are
   134  	// `Tags` (default): use git tags or fall back to abbreviated commit hash.
   135  	// `CommitSha`: use the full git commit sha.
   136  	// `AbbrevCommitSha`: use the abbreviated git commit sha.
   137  	// `TreeSha`: use the full tree hash of the artifact workingdir.
   138  	// `AbbrevTreeSha`: use the abbreviated tree hash of the artifact workingdir.
   139  	Variant string `yaml:"variant,omitempty"`
   140  }
   141  
   142  // EnvTemplateTagger *beta* tags images with a configurable template string.
   143  type EnvTemplateTagger struct {
   144  	// Template used to produce the image name and tag.
   145  	// See golang [text/template](https://golang.org/pkg/text/template/).
   146  	// The template is executed against the current environment,
   147  	// with those variables injected:
   148  	//   IMAGE_NAME   |  Name of the image being built, as supplied in the artifacts section.
   149  	// For example: `{{.RELEASE}}-{{.IMAGE_NAME}}`.
   150  	Template string `yaml:"template,omitempty" yamltags:"required"`
   151  }
   152  
   153  // DateTimeTagger *beta* tags images with the build timestamp.
   154  type DateTimeTagger struct {
   155  	// Format formats the date and time.
   156  	// See [#Time.Format](https://golang.org/pkg/time/#Time.Format).
   157  	// Defaults to `2006-01-02_15-04-05.999_MST`.
   158  	Format string `yaml:"format,omitempty"`
   159  
   160  	// TimeZone sets the timezone for the date and time.
   161  	// See [Time.LoadLocation](https://golang.org/pkg/time/#Time.LoadLocation).
   162  	// Defaults to the local timezone.
   163  	TimeZone string `yaml:"timezone,omitempty"`
   164  }
   165  
   166  // BuildType contains the specific implementation and parameters needed
   167  // for the build step. Only one field should be populated.
   168  type BuildType struct {
   169  	// LocalBuild *beta* describes how to do a build on the local docker daemon
   170  	// and optionally push to a repository.
   171  	LocalBuild *LocalBuild `yaml:"local,omitempty" yamltags:"oneOf=build"`
   172  
   173  	// GoogleCloudBuild *beta* describes how to do a remote build on
   174  	// [Google Cloud Build](https://cloud.google.com/cloud-build/).
   175  	GoogleCloudBuild *GoogleCloudBuild `yaml:"googleCloudBuild,omitempty" yamltags:"oneOf=build"`
   176  
   177  	// Cluster *beta* describes how to do an on-cluster build.
   178  	Cluster *ClusterDetails `yaml:"cluster,omitempty" yamltags:"oneOf=build"`
   179  }
   180  
   181  // LocalBuild *beta* describes how to do a build on the local docker daemon
   182  // and optionally push to a repository.
   183  type LocalBuild struct {
   184  	// Push should images be pushed to a registry.
   185  	// If not specified, images are pushed only if the current Kubernetes context
   186  	// connects to a remote cluster.
   187  	Push *bool `yaml:"push,omitempty"`
   188  
   189  	// UseDockerCLI use `docker` command-line interface instead of Docker Engine APIs.
   190  	UseDockerCLI bool `yaml:"useDockerCLI,omitempty"`
   191  
   192  	// UseBuildkit use BuildKit to build Docker images. If unspecified, uses the Docker default.
   193  	UseBuildkit *bool `yaml:"useBuildkit,omitempty"`
   194  }
   195  
   196  // GoogleCloudBuild *beta* describes how to do a remote build on
   197  // [Google Cloud Build](https://cloud.google.com/cloud-build/docs/).
   198  // Docker and Jib artifacts can be built on Cloud Build. The `projectId` needs
   199  // to be provided and the currently logged in user should be given permissions to trigger
   200  // new builds.
   201  type GoogleCloudBuild struct {
   202  	// ProjectID is the ID of your Cloud Platform Project.
   203  	// If it is not provided, Skaffold will guess it from the image name.
   204  	// For example, given the artifact image name `gcr.io/myproject/image`, Skaffold
   205  	// will use the `myproject` GCP project.
   206  	ProjectID string `yaml:"projectId,omitempty"`
   207  
   208  	// DiskSizeGb is the disk size of the VM that runs the build.
   209  	// See [Cloud Build Reference](https://cloud.google.com/cloud-build/docs/api/reference/rest/v1/projects.builds#buildoptions).
   210  	DiskSizeGb int64 `yaml:"diskSizeGb,omitempty"`
   211  
   212  	// MachineType is the type of the VM that runs the build.
   213  	// See [Cloud Build Reference](https://cloud.google.com/cloud-build/docs/api/reference/rest/v1/projects.builds#buildoptions).
   214  	MachineType string `yaml:"machineType,omitempty"`
   215  
   216  	// Timeout is the amount of time (in seconds) that this build should be allowed to run.
   217  	// See [Cloud Build Reference](https://cloud.google.com/cloud-build/docs/api/reference/rest/v1/projects.builds#resource-build).
   218  	Timeout string `yaml:"timeout,omitempty"`
   219  
   220  	// DockerImage is the image that runs a Docker build.
   221  	// See [Cloud Builders](https://cloud.google.com/cloud-build/docs/cloud-builders).
   222  	// Defaults to `gcr.io/cloud-builders/docker`.
   223  	DockerImage string `yaml:"dockerImage,omitempty"`
   224  
   225  	// KanikoImage is the image that runs a Kaniko build.
   226  	// See [Cloud Builders](https://cloud.google.com/cloud-build/docs/cloud-builders).
   227  	// Defaults to `gcr.io/kaniko-project/executor`.
   228  	KanikoImage string `yaml:"kanikoImage,omitempty"`
   229  
   230  	// MavenImage is the image that runs a Maven build.
   231  	// See [Cloud Builders](https://cloud.google.com/cloud-build/docs/cloud-builders).
   232  	// Defaults to `gcr.io/cloud-builders/mvn`.
   233  	MavenImage string `yaml:"mavenImage,omitempty"`
   234  
   235  	// GradleImage is the image that runs a Gradle build.
   236  	// See [Cloud Builders](https://cloud.google.com/cloud-build/docs/cloud-builders).
   237  	// Defaults to `gcr.io/cloud-builders/gradle`.
   238  	GradleImage string `yaml:"gradleImage,omitempty"`
   239  
   240  	// Concurrency is how many artifacts can be built concurrently. 0 means "no-limit"
   241  	// Defaults to 0.
   242  	Concurrency int `yaml:"concurrency,omitempty"`
   243  }
   244  
   245  // LocalDir configures how Kaniko mounts sources directly via an `emptyDir` volume.
   246  type LocalDir struct {
   247  	// InitImage is the image used to run init container which mounts kaniko context.
   248  	InitImage string `yaml:"initImage,omitempty"`
   249  }
   250  
   251  // KanikoBuildContext contains the different fields available to specify
   252  // a Kaniko build context.
   253  type KanikoBuildContext struct {
   254  	// GCSBucket is the GCS bucket to which sources are uploaded.
   255  	// Kaniko will need access to that bucket to download the sources.
   256  	GCSBucket string `yaml:"gcsBucket,omitempty" yamltags:"oneOf=buildContext"`
   257  
   258  	// LocalDir configures how Kaniko mounts sources directly via an `emptyDir` volume.
   259  	LocalDir *LocalDir `yaml:"localDir,omitempty" yamltags:"oneOf=buildContext"`
   260  }
   261  
   262  // KanikoCache configures Kaniko caching. If a cache is specified, Kaniko will
   263  // use a remote cache which will speed up builds.
   264  type KanikoCache struct {
   265  	// Repo is a remote repository to store cached layers. If none is specified, one will be
   266  	// inferred from the image name. See [Kaniko Caching](https://github.com/GoogleContainerTools/kaniko#caching).
   267  	Repo string `yaml:"repo,omitempty"`
   268  	// HostPath specifies a path on the host that is mounted to each pod as read only cache volume containing base images.
   269  	// If set, must exist on each node and prepopulated with kaniko-warmer.
   270  	HostPath string `yaml:"hostPath,omitempty"`
   271  }
   272  
   273  // ClusterDetails *beta* describes how to do an on-cluster build.
   274  type ClusterDetails struct {
   275  	// HTTPProxy for kaniko pod.
   276  	HTTPProxy string `yaml:"HTTP_PROXY,omitempty"`
   277  
   278  	// HTTPSProxy for kaniko pod.
   279  	HTTPSProxy string `yaml:"HTTPS_PROXY,omitempty"`
   280  
   281  	// PullSecret is the path to the Google Cloud service account secret key file.
   282  	PullSecret string `yaml:"pullSecret,omitempty"`
   283  
   284  	// PullSecretName is the name of the Kubernetes secret for pulling the files
   285  	// from the build context and pushing the final image. If given, the secret needs to
   286  	// contain the Google Cloud service account secret key under the key `kaniko-secret`.
   287  	// Defaults to `kaniko-secret`.
   288  	PullSecretName string `yaml:"pullSecretName,omitempty"`
   289  
   290  	// PullSecretMountPath is the path the pull secret will be mounted at within the running container.
   291  	PullSecretMountPath string `yaml:"pullSecretMountPath,omitempty"`
   292  
   293  	// Namespace is the Kubernetes namespace.
   294  	// Defaults to current namespace in Kubernetes configuration.
   295  	Namespace string `yaml:"namespace,omitempty"`
   296  
   297  	// Timeout is the amount of time (in seconds) that this build is allowed to run.
   298  	// Defaults to 20 minutes (`20m`).
   299  	Timeout string `yaml:"timeout,omitempty"`
   300  
   301  	// DockerConfig describes how to mount the local Docker configuration into a pod.
   302  	DockerConfig *DockerConfig `yaml:"dockerConfig,omitempty"`
   303  
   304  	// Resources define the resource requirements for the kaniko pod.
   305  	Resources *ResourceRequirements `yaml:"resources,omitempty"`
   306  
   307  	// Concurrency is how many artifacts can be built concurrently. 0 means "no-limit"
   308  	// Defaults to 0.
   309  	Concurrency int `yaml:"concurrency,omitempty"`
   310  }
   311  
   312  // DockerConfig contains information about the docker `config.json` to mount.
   313  type DockerConfig struct {
   314  	// Path is the path to the docker `config.json`.
   315  	Path string `yaml:"path,omitempty"`
   316  
   317  	// SecretName is the Kubernetes secret that contains the `config.json` Docker configuration.
   318  	// Note that the expected secret type is not 'kubernetes.io/dockerconfigjson' but 'Opaque'.
   319  	SecretName string `yaml:"secretName,omitempty"`
   320  }
   321  
   322  // ResourceRequirements describes the resource requirements for the kaniko pod.
   323  type ResourceRequirements struct {
   324  	// 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.
   325  	Requests *ResourceRequirement `yaml:"requests,omitempty"`
   326  
   327  	// 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.
   328  	Limits *ResourceRequirement `yaml:"limits,omitempty"`
   329  }
   330  
   331  // ResourceRequirement stores the CPU/Memory requirements for the pod.
   332  type ResourceRequirement struct {
   333  	// CPU the number cores to be used.
   334  	// For example: `2`, `2.0` or `200m`.
   335  	CPU string `yaml:"cpu,omitempty"`
   336  
   337  	// Memory the amount of memory to allocate to the pod.
   338  	// For example: `1Gi` or `1000Mi`.
   339  	Memory string `yaml:"memory,omitempty"`
   340  
   341  	// EphemeralStorage the amount of Ephemeral storage to allocate to the pod.
   342  	// For example: `1Gi` or `1000Mi`.
   343  	EphemeralStorage string `yaml:"ephemeralStorage,omitempty"`
   344  
   345  	// ResourceStorage the amount of resource storage to allocate to the pod.
   346  	// For example: `1Gi` or `1000Mi`.
   347  	ResourceStorage string `yaml:"resourceStorage,omitempty"`
   348  }
   349  
   350  // TestCase is a list of structure tests to run on images that Skaffold builds.
   351  type TestCase struct {
   352  	// ImageName is the artifact on which to run those tests.
   353  	// For example: `gcr.io/k8s-skaffold/example`.
   354  	ImageName string `yaml:"image" yamltags:"required"`
   355  
   356  	// StructureTests lists the [Container Structure Tests](https://github.com/GoogleContainerTools/container-structure-test)
   357  	// to run on that artifact.
   358  	// For example: `["./test/*"]`.
   359  	StructureTests []string `yaml:"structureTests,omitempty"`
   360  }
   361  
   362  // DeployConfig contains all the configuration needed by the deploy steps.
   363  type DeployConfig struct {
   364  	DeployType `yaml:",inline"`
   365  
   366  	// StatusCheckDeadlineSeconds *beta* is the deadline for deployments to stabilize in seconds.
   367  	StatusCheckDeadlineSeconds int `yaml:"statusCheckDeadlineSeconds,omitempty"`
   368  
   369  	// KubeContext is the Kubernetes context that Skaffold should deploy to.
   370  	// For example: `minikube`.
   371  	KubeContext string `yaml:"kubeContext,omitempty"`
   372  }
   373  
   374  // DeployType contains the specific implementation and parameters needed
   375  // for the deploy step. Only one field should be populated.
   376  type DeployType struct {
   377  	// HelmDeploy *beta* uses the `helm` CLI to apply the charts to the cluster.
   378  	HelmDeploy *HelmDeploy `yaml:"helm,omitempty" yamltags:"oneOf=deploy"`
   379  
   380  	// KubectlDeploy *beta* uses a client side `kubectl apply` to deploy manifests.
   381  	// You'll need a `kubectl` CLI version installed that's compatible with your cluster.
   382  	KubectlDeploy *KubectlDeploy `yaml:"kubectl,omitempty" yamltags:"oneOf=deploy"`
   383  
   384  	// KustomizeDeploy *beta* uses the `kustomize` CLI to "patch" a deployment for a target environment.
   385  	KustomizeDeploy *KustomizeDeploy `yaml:"kustomize,omitempty" yamltags:"oneOf=deploy"`
   386  }
   387  
   388  // KubectlDeploy *beta* uses a client side `kubectl apply` to deploy manifests.
   389  // You'll need a `kubectl` CLI version installed that's compatible with your cluster.
   390  type KubectlDeploy struct {
   391  	// Manifests lists the Kubernetes yaml or json manifests.
   392  	// Defaults to `["k8s/*.yaml"]`.
   393  	Manifests []string `yaml:"manifests,omitempty"`
   394  
   395  	// RemoteManifests lists Kubernetes manifests in remote clusters.
   396  	RemoteManifests []string `yaml:"remoteManifests,omitempty"`
   397  
   398  	// Flags are additional flags passed to `kubectl`.
   399  	Flags KubectlFlags `yaml:"flags,omitempty"`
   400  }
   401  
   402  // KubectlFlags are additional flags passed on the command
   403  // line to kubectl either on every command (Global), on creations (Apply)
   404  // or deletions (Delete).
   405  type KubectlFlags struct {
   406  	// Global are additional flags passed on every command.
   407  	Global []string `yaml:"global,omitempty"`
   408  
   409  	// Apply are additional flags passed on creations (`kubectl apply`).
   410  	Apply []string `yaml:"apply,omitempty"`
   411  
   412  	// Delete are additional flags passed on deletions (`kubectl delete`).
   413  	Delete []string `yaml:"delete,omitempty"`
   414  }
   415  
   416  // HelmDeploy *beta* uses the `helm` CLI to apply the charts to the cluster.
   417  type HelmDeploy struct {
   418  	// Releases is a list of Helm releases.
   419  	Releases []HelmRelease `yaml:"releases,omitempty" yamltags:"required"`
   420  
   421  	// Flags are additional option flags that are passed on the command
   422  	// line to `helm`.
   423  	Flags HelmDeployFlags `yaml:"flags,omitempty"`
   424  }
   425  
   426  // HelmDeployFlags are additional option flags that are passed on the command
   427  // line to `helm`.
   428  type HelmDeployFlags struct {
   429  	// Global are additional flags passed on every command.
   430  	Global []string `yaml:"global,omitempty"`
   431  
   432  	// Install are additional flags passed to (`helm install`).
   433  	Install []string `yaml:"install,omitempty"`
   434  
   435  	// Upgrade are additional flags passed to (`helm upgrade`).
   436  	Upgrade []string `yaml:"upgrade,omitempty"`
   437  }
   438  
   439  // KustomizeDeploy *beta* uses the `kustomize` CLI to "patch" a deployment for a target environment.
   440  type KustomizeDeploy struct {
   441  	// KustomizePath is the path to Kustomization files.
   442  	// Defaults to `.`.
   443  	KustomizePath string `yaml:"path,omitempty"`
   444  
   445  	// Flags are additional flags passed to `kubectl`.
   446  	Flags KubectlFlags `yaml:"flags,omitempty"`
   447  
   448  	// BuildArgs are additional args passed to `kustomize build`.
   449  	BuildArgs []string `yaml:"buildArgs,omitempty"`
   450  }
   451  
   452  // HelmRelease describes a helm release to be deployed.
   453  type HelmRelease struct {
   454  	// Name is the name of the Helm release.
   455  	Name string `yaml:"name,omitempty" yamltags:"required"`
   456  
   457  	// ChartPath is the path to the Helm chart.
   458  	ChartPath string `yaml:"chartPath,omitempty" yamltags:"required"`
   459  
   460  	// ValuesFiles are the paths to the Helm `values` files.
   461  	ValuesFiles []string `yaml:"valuesFiles,omitempty"`
   462  
   463  	// Values are key-value pairs supplementing the Helm `values` file.
   464  	Values map[string]string `yaml:"values,omitempty,omitempty"`
   465  
   466  	// Namespace is the Kubernetes namespace.
   467  	Namespace string `yaml:"namespace,omitempty"`
   468  
   469  	// Version is the version of the chart.
   470  	Version string `yaml:"version,omitempty"`
   471  
   472  	// SetValues are key-value pairs.
   473  	// If present, Skaffold will send `--set` flag to Helm CLI and append all pairs after the flag.
   474  	SetValues map[string]string `yaml:"setValues,omitempty"`
   475  
   476  	// SetValueTemplates are key-value pairs.
   477  	// If present, Skaffold will try to parse the value part of each key-value pair using
   478  	// environment variables in the system, then send `--set` flag to Helm CLI and append
   479  	// all parsed pairs after the flag.
   480  	SetValueTemplates map[string]string `yaml:"setValueTemplates,omitempty"`
   481  
   482  	// SetFiles are key-value pairs.
   483  	// If present, Skaffold will send `--set-file` flag to Helm CLI and append all pairs after the flag.
   484  	SetFiles map[string]string `yaml:"setFiles,omitempty"`
   485  
   486  	// Wait if `true`, Skaffold will send `--wait` flag to Helm CLI.
   487  	// Defaults to `false`.
   488  	Wait bool `yaml:"wait,omitempty"`
   489  
   490  	// RecreatePods if `true`, Skaffold will send `--recreate-pods` flag to Helm CLI
   491  	// when upgrading a new version of a chart in subsequent dev loop deploy.
   492  	// Defaults to `false`.
   493  	RecreatePods bool `yaml:"recreatePods,omitempty"`
   494  
   495  	// SkipBuildDependencies should build dependencies be skipped.
   496  	SkipBuildDependencies bool `yaml:"skipBuildDependencies,omitempty"`
   497  
   498  	// UseHelmSecrets instructs skaffold to use secrets plugin on deployment.
   499  	UseHelmSecrets bool `yaml:"useHelmSecrets,omitempty"`
   500  
   501  	// Remote specifies whether the chart path is remote, or exists on the host filesystem.
   502  	// `remote: true` implies `skipBuildDependencies: true`.
   503  	Remote bool `yaml:"remote,omitempty"`
   504  
   505  	// Overrides are key-value pairs.
   506  	// If present, Skaffold will build a Helm `values` file that overrides
   507  	// the original and use it to call Helm CLI (`--f` flag).
   508  	Overrides util.HelmOverrides `yaml:"overrides,omitempty"`
   509  
   510  	// Packaged parameters for packaging helm chart (`helm package`).
   511  	Packaged *HelmPackaged `yaml:"packaged,omitempty"`
   512  
   513  	// ImageStrategy adds image configurations to the Helm `values` file.
   514  	ImageStrategy HelmImageStrategy `yaml:"imageStrategy,omitempty"`
   515  }
   516  
   517  // HelmPackaged parameters for packaging helm chart (`helm package`).
   518  type HelmPackaged struct {
   519  	// Version sets the `version` on the chart to this semver version.
   520  	Version string `yaml:"version,omitempty"`
   521  
   522  	// AppVersion sets the `appVersion` on the chart to this version.
   523  	AppVersion string `yaml:"appVersion,omitempty"`
   524  }
   525  
   526  // HelmImageStrategy adds image configurations to the Helm `values` file.
   527  type HelmImageStrategy struct {
   528  	HelmImageConfig `yaml:",inline"`
   529  }
   530  
   531  // HelmImageConfig describes an image configuration.
   532  type HelmImageConfig struct {
   533  	// HelmFQNConfig is the image configuration uses the syntax `IMAGE-NAME=IMAGE-REPOSITORY:IMAGE-TAG`.
   534  	HelmFQNConfig *HelmFQNConfig `yaml:"fqn,omitempty" yamltags:"oneOf=helmImageStrategy"`
   535  
   536  	// HelmConventionConfig is the image configuration uses the syntax `IMAGE-NAME.repository=IMAGE-REPOSITORY, IMAGE-NAME.tag=IMAGE-TAG`.
   537  	HelmConventionConfig *HelmConventionConfig `yaml:"helm,omitempty" yamltags:"oneOf=helmImageStrategy"`
   538  }
   539  
   540  // HelmFQNConfig is the image config to use the FullyQualifiedImageName as param to set.
   541  type HelmFQNConfig struct {
   542  	// Property defines the image config.
   543  	Property string `yaml:"property,omitempty"`
   544  }
   545  
   546  // HelmConventionConfig is the image config in the syntax of image.repository and image.tag.
   547  type HelmConventionConfig struct {
   548  	// ExplicitRegistry separates `image.registry` to the image config syntax. Useful for some charts e.g. `postgresql`.
   549  	ExplicitRegistry bool `yaml:"explicitRegistry,omitempty"`
   550  }
   551  
   552  // Artifact are the items that need to be built, along with the context in which
   553  // they should be built.
   554  type Artifact struct {
   555  	// ImageName is the name of the image to be built.
   556  	// For example: `gcr.io/k8s-skaffold/example`.
   557  	ImageName string `yaml:"image,omitempty" yamltags:"required"`
   558  
   559  	// Workspace is the directory containing the artifact's sources.
   560  	// Defaults to `.`.
   561  	Workspace string `yaml:"context,omitempty"`
   562  
   563  	// Sync *beta* lists local files synced to pods instead
   564  	// of triggering an image build when modified.
   565  	Sync *Sync `yaml:"sync,omitempty"`
   566  
   567  	// ArtifactType describes how to build an artifact.
   568  	ArtifactType `yaml:",inline"`
   569  }
   570  
   571  // Sync *beta* specifies what files to sync into the container.
   572  // This is a list of sync rules indicating the intent to sync for source files.
   573  type Sync struct {
   574  	// Manual lists manual sync rules indicating the source and destination.
   575  	Manual []*SyncRule `yaml:"manual,omitempty" yamltags:"oneOf=sync"`
   576  
   577  	// Infer lists file patterns which may be synced into the container.
   578  	// The container destination is inferred by the builder.
   579  	// Currently only available for docker artifacts.
   580  	Infer []string `yaml:"infer,omitempty" yamltags:"oneOf=sync"`
   581  }
   582  
   583  // SyncRule specifies which local files to sync to remote folders.
   584  type SyncRule struct {
   585  	// Src is a glob pattern to match local paths against.
   586  	// Directories should be delimited by `/` on all platforms.
   587  	// For example: `"css/**/*.css"`.
   588  	Src string `yaml:"src,omitempty" yamltags:"required"`
   589  
   590  	// Dest is the destination path in the container where the files should be synced to.
   591  	// For example: `"app/"`
   592  	Dest string `yaml:"dest,omitempty" yamltags:"required"`
   593  
   594  	// Strip specifies the path prefix to remove from the source path when
   595  	// transplanting the files into the destination folder.
   596  	// For example: `"css/"`
   597  	Strip string `yaml:"strip,omitempty"`
   598  }
   599  
   600  // Profile is used to override any `build`, `test` or `deploy` configuration.
   601  type Profile struct {
   602  	// Name is a unique profile name.
   603  	// For example: `profile-prod`.
   604  	Name string `yaml:"name,omitempty" yamltags:"required"`
   605  
   606  	// Pipeline contains the definitions to replace the default skaffold pipeline.
   607  	Pipeline `yaml:",inline"`
   608  
   609  	// Patches lists patches applied to the configuration.
   610  	// Patches use the JSON patch notation.
   611  	Patches []JSONPatch `yaml:"patches,omitempty"`
   612  
   613  	// Activation criteria by which a profile can be auto-activated.
   614  	// The profile is auto-activated if any one of the activations are triggered.
   615  	// An activation is triggered if all of the criteria (env, kubeContext, command) are triggered.
   616  	Activation []Activation `yaml:"activation,omitempty"`
   617  }
   618  
   619  // JSONPatch patch to be applied by a profile.
   620  type JSONPatch struct {
   621  	// Op is the operation carried by the patch: `add`, `remove`, `replace`, `move`, `copy` or `test`.
   622  	// Defaults to `replace`.
   623  	Op string `yaml:"op,omitempty"`
   624  
   625  	// Path is the position in the yaml where the operation takes place.
   626  	// For example, this targets the `dockerfile` of the first artifact built.
   627  	// For example: `/build/artifacts/0/docker/dockerfile`.
   628  	Path string `yaml:"path,omitempty" yamltags:"required"`
   629  
   630  	// From is the source position in the yaml, used for `copy` or `move` operations.
   631  	From string `yaml:"from,omitempty"`
   632  
   633  	// Value is the value to apply. Can be any portion of yaml.
   634  	Value *util.YamlpatchNode `yaml:"value,omitempty"`
   635  }
   636  
   637  // Activation criteria by which a profile is auto-activated.
   638  type Activation struct {
   639  	// Env is a `key=pattern` pair. The profile is auto-activated if an Environment
   640  	// Variable `key` matches the pattern. If the pattern starts with `!`, activation
   641  	// happens if the remaining pattern is _not_ matched. The pattern matches if the
   642  	// Environment Variable value is exactly `pattern`, or the regex `pattern` is
   643  	// found in it. An empty `pattern` (e.g. `env: "key="`) always only matches if
   644  	// the Environment Variable is undefined or empty.
   645  	// For example: `ENV=production`
   646  	Env string `yaml:"env,omitempty"`
   647  
   648  	// KubeContext is a Kubernetes context for which the profile is auto-activated.
   649  	// For example: `minikube`.
   650  	KubeContext string `yaml:"kubeContext,omitempty"`
   651  
   652  	// Command is a Skaffold command for which the profile is auto-activated.
   653  	// For example: `dev`.
   654  	Command string `yaml:"command,omitempty"`
   655  }
   656  
   657  // ArtifactType describes how to build an artifact.
   658  type ArtifactType struct {
   659  	// DockerArtifact *beta* describes an artifact built from a Dockerfile.
   660  	DockerArtifact *DockerArtifact `yaml:"docker,omitempty" yamltags:"oneOf=artifact"`
   661  
   662  	// BazelArtifact *beta* requires bazel CLI to be installed and the sources to
   663  	// contain [Bazel](https://bazel.build/) configuration files.
   664  	BazelArtifact *BazelArtifact `yaml:"bazel,omitempty" yamltags:"oneOf=artifact"`
   665  
   666  	// JibArtifact builds images using the
   667  	// [Jib plugins for Maven or Gradle](https://github.com/GoogleContainerTools/jib/).
   668  	JibArtifact *JibArtifact `yaml:"jib,omitempty" yamltags:"oneOf=artifact"`
   669  
   670  	// KanikoArtifact builds images using [kaniko](https://github.com/GoogleContainerTools/kaniko).
   671  	KanikoArtifact *KanikoArtifact `yaml:"kaniko,omitempty" yamltags:"oneOf=artifact"`
   672  
   673  	// BuildpackArtifact builds images using [Cloud Native Buildpacks](https://buildpacks.io/).
   674  	BuildpackArtifact *BuildpackArtifact `yaml:"buildpack,omitempty" yamltags:"oneOf=artifact"`
   675  
   676  	// CustomArtifact *beta* builds images using a custom build script written by the user.
   677  	CustomArtifact *CustomArtifact `yaml:"custom,omitempty" yamltags:"oneOf=artifact"`
   678  }
   679  
   680  // BuildpackArtifact *alpha* describes an artifact built using [Cloud Native Buildpacks](https://buildpacks.io/).
   681  // It can be used to build images out of project's sources without any additional configuration.
   682  type BuildpackArtifact struct {
   683  	// ForcePull should the builder image be pull before each build.
   684  	ForcePull bool `yaml:"forcePull,omitempty"`
   685  
   686  	// Builder is the builder image used.
   687  	Builder string `yaml:"builder" yamltags:"required"`
   688  
   689  	// RunImage overrides the stack's default run image.
   690  	RunImage string `yaml:"runImage,omitempty"`
   691  
   692  	// Dependencies are the file dependencies that skaffold should watch for both rebuilding and file syncing for this artifact.
   693  	Dependencies *BuildpackDependencies `yaml:"dependencies,omitempty"`
   694  }
   695  
   696  // BuildpackDependencies *alpha* is used to specify dependencies for an artifact built by a buildpack.
   697  type BuildpackDependencies struct {
   698  	// 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.
   699  	Paths []string `yaml:"paths,omitempty" yamltags:"oneOf=dependency"`
   700  
   701  	// 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.
   702  	// Will only work in conjunction with `paths`.
   703  	Ignore []string `yaml:"ignore,omitempty"`
   704  }
   705  
   706  // CustomArtifact *beta* describes an artifact built from a custom build script
   707  // written by the user. It can be used to build images with builders that aren't directly integrated with skaffold.
   708  type CustomArtifact struct {
   709  	// BuildCommand is the command executed to build the image.
   710  	BuildCommand string `yaml:"buildCommand,omitempty"`
   711  	// Dependencies are the file dependencies that skaffold should watch for both rebuilding and file syncing for this artifact.
   712  	Dependencies *CustomDependencies `yaml:"dependencies,omitempty"`
   713  }
   714  
   715  // CustomDependencies *beta* is used to specify dependencies for an artifact built by a custom build script.
   716  // Either `dockerfile` or `paths` should be specified for file watching to work as expected.
   717  type CustomDependencies struct {
   718  	// Dockerfile should be set if the artifact is built from a Dockerfile, from which skaffold can determine dependencies.
   719  	Dockerfile *DockerfileDependency `yaml:"dockerfile,omitempty" yamltags:"oneOf=dependency"`
   720  	// Command represents a custom command that skaffold executes to obtain dependencies. The output of this command *must* be a valid JSON array.
   721  	Command string `yaml:"command,omitempty" yamltags:"oneOf=dependency"`
   722  	// 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.
   723  	Paths []string `yaml:"paths,omitempty" yamltags:"oneOf=dependency"`
   724  	// 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.
   725  	// Will only work in conjunction with `paths`.
   726  	Ignore []string `yaml:"ignore,omitempty"`
   727  }
   728  
   729  // 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.
   730  type DockerfileDependency struct {
   731  	// Path locates the Dockerfile relative to workspace.
   732  	Path string `yaml:"path,omitempty"`
   733  
   734  	// BuildArgs are arguments passed to the docker build.
   735  	// It also accepts environment variables via the go template syntax.
   736  	// For example: `{"key1": "value1", "key2": "value2", "key3": "{{.ENV_VARIABLE}}"}`.
   737  	BuildArgs map[string]*string `yaml:"buildArgs,omitempty"`
   738  }
   739  
   740  // KanikoArtifact describes an artifact built from a Dockerfile,
   741  // with kaniko.
   742  type KanikoArtifact struct {
   743  	// AdditionalFlags are additional flags to be passed to Kaniko command line.
   744  	// See [Kaniko Additional Flags](https://github.com/GoogleContainerTools/kaniko#additional-flags).
   745  	// Deprecated - instead the named, unique fields should be used, e.g. `buildArgs`, `cache`, `target`.
   746  	AdditionalFlags []string `yaml:"flags,omitempty"`
   747  
   748  	// DockerfilePath locates the Dockerfile relative to workspace.
   749  	// Defaults to `Dockerfile`.
   750  	DockerfilePath string `yaml:"dockerfile,omitempty"`
   751  
   752  	// Target is the Dockerfile target name to build.
   753  	Target string `yaml:"target,omitempty"`
   754  
   755  	// BuildArgs are arguments passed to the docker build.
   756  	// It also accepts environment variables via the go template syntax.
   757  	// For example: `{"key1": "value1", "key2": "value2", "key3": "{{.ENV_VARIABLE}}"}`.
   758  	BuildArgs map[string]*string `yaml:"buildArgs,omitempty"`
   759  
   760  	// BuildContext is where the build context for this artifact resides.
   761  	BuildContext *KanikoBuildContext `yaml:"buildContext,omitempty"`
   762  
   763  	// Image is the Docker image used by the Kaniko pod.
   764  	// Defaults to the latest released version of `gcr.io/kaniko-project/executor`.
   765  	Image string `yaml:"image,omitempty"`
   766  
   767  	// Cache configures Kaniko caching. If a cache is specified, Kaniko will
   768  	// use a remote cache which will speed up builds.
   769  	Cache *KanikoCache `yaml:"cache,omitempty"`
   770  
   771  	// Reproducible is used to strip timestamps out of the built image.
   772  	Reproducible bool `yaml:"reproducible,omitempty"`
   773  
   774  	// SkipTLS skips TLS verification when pulling and pushing the image.
   775  	SkipTLS bool `yaml:"skipTLS,omitempty"`
   776  }
   777  
   778  // DockerArtifact describes an artifact built from a Dockerfile,
   779  // usually using `docker build`.
   780  type DockerArtifact struct {
   781  	// DockerfilePath locates the Dockerfile relative to workspace.
   782  	// Defaults to `Dockerfile`.
   783  	DockerfilePath string `yaml:"dockerfile,omitempty"`
   784  
   785  	// Target is the Dockerfile target name to build.
   786  	Target string `yaml:"target,omitempty"`
   787  
   788  	// BuildArgs are arguments passed to the docker build.
   789  	// For example: `{"key1": "value1", "key2": "value2"}`.
   790  	BuildArgs map[string]*string `yaml:"buildArgs,omitempty"`
   791  
   792  	// NetworkMode is passed through to docker and overrides the
   793  	// network configuration of docker builder. If unset, use whatever
   794  	// is configured in the underlying docker daemon. Valid modes are
   795  	// `host`: use the host's networking stack.
   796  	// `bridge`: use the bridged network configuration.
   797  	// `none`: no networking in the container.
   798  	NetworkMode string `yaml:"network,omitempty"`
   799  
   800  	// CacheFrom lists the Docker images used as cache sources.
   801  	// For example: `["golang:1.10.1-alpine3.7", "alpine:3.7"]`.
   802  	CacheFrom []string `yaml:"cacheFrom,omitempty"`
   803  
   804  	// NoCache used to pass in --no-cache to docker build to prevent caching.
   805  	NoCache bool `yaml:"noCache,omitempty"`
   806  }
   807  
   808  // BazelArtifact describes an artifact built with [Bazel](https://bazel.build/).
   809  type BazelArtifact struct {
   810  	// BuildTarget is the `bazel build` target to run.
   811  	// For example: `//:skaffold_example.tar`.
   812  	BuildTarget string `yaml:"target,omitempty" yamltags:"required"`
   813  
   814  	// BuildArgs are additional args to pass to `bazel build`.
   815  	// For example: `["-flag", "--otherflag"]`.
   816  	BuildArgs []string `yaml:"args,omitempty"`
   817  }
   818  
   819  // JibArtifact builds images using the
   820  // [Jib plugins for Maven and Gradle](https://github.com/GoogleContainerTools/jib/).
   821  type JibArtifact struct {
   822  	// Project selects which sub-project to build for multi-module builds.
   823  	Project string `yaml:"project,omitempty"`
   824  
   825  	// Flags are additional build flags passed to the builder.
   826  	// For example: `["--no-build-cache"]`.
   827  	Flags []string `yaml:"args,omitempty"`
   828  
   829  	// Type the Jib builder type; normally determined automatically. Valid types are
   830  	// `maven`: for Maven.
   831  	// `gradle`: for Gradle.
   832  	Type string `yaml:"type,omitempty"`
   833  }