configs

package
v0.19.765 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 4, 2026 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PrivateDockerPullBuildEncodedAuthString

func PrivateDockerPullBuildEncodedAuthString(username, password string) (string, error)

Types

type AWSECRRegistry

type AWSECRRegistry struct {
	Plugin string `hcl:"plugin,label"`

	Repository string `hcl:"repository"`
	Tag        string `hcl:"tag"`
	Region     string `hcl:"region,optional"`
}

type App

type App[B, D any] struct {
	Name string `hcl:"name,label"`

	Build  B `hcl:"build,block"`
	Deploy D `hcl:"deploy,block"`
}

type Apps

type Apps[B, D any] struct {
	Project string `hcl:"project"`

	App App[B, D] `hcl:"app,block"`
}

func (*Apps[B, D]) ToHCL

func (a *Apps[B, D]) ToHCL() []byte

type Auth

type Auth struct {
	Hostname      string `hcl:"hostname,optional"`
	Username      string `hcl:"username,optional"`
	Password      string `hcl:"password,optional"`
	Email         string `hcl:"email,optional"`
	Auth          string `hcl:"auth,optional"`
	EncodedAuth   string `hcl:"auth,optional"`
	ServerAddress string `hcl:"serverAddress,optional"`
	IdentityToken string `hcl:"identityToken,optional"`
	RegistryToken string `hcl:"registryToken,optional"`
}

type AutoscaleConfig

type AutoscaleConfig struct {
	MinReplicas int32 `hcl:"min_replicas,optional"`
	MaxReplicas int32 `hcl:"max_replicas,optional"`
	// TargetCPU will determine the max load before the autoscaler will increase
	// a replica
	TargetCPU int32 `hcl:"cpu_percent,optional"`
}

AutoscaleConfig describes the possible configuration for creating a horizontal pod autoscaler

type BasicDeploy

type BasicDeploy struct {
	Plugin string `hcl:"plugin,label"`

	// Annotations are added to the pod spec of the deployed application.  This is
	// useful when using mutating webhook admission controllers to further process
	// pod events.
	Annotations map[string]string `hcl:"annotations,optional"`

	// AutoscaleConfig will create a horizontal pod autoscaler for a given
	// deployment and scale the replica pods up or down based on a given
	// load metric, such as CPU utilization
	AutoscaleConfig *AutoscaleConfig `hcl:"autoscale,block"`

	// Context specifies the kube context to use.
	Context string `hcl:"context,optional"`

	// The number of replicas of the service to maintain. If this number is maintained
	// outside waypoint, for instance by a pod autoscaler, do not set this variable.
	Count int32 `hcl:"replicas,optional"`

	// The name of the Kubernetes secret to use to pull the image stored
	// in the registry.
	// TODO This maybe should be required because the vast majority of deployments
	// will be against private images.
	ImageSecret string `hcl:"image_secret,optional"`

	// KubeconfigPath is the path to the kubeconfig file. If this is
	// blank then we default to the home directory.
	KubeconfigPath string `hcl:"kubeconfig,optional"`

	// A map of key vals to label the deployed Pod and Deployment with.
	Labels map[string]string `hcl:"labels,optional"`

	// Namespace is the Kubernetes namespace to target the deployment to.
	Namespace string `hcl:"namespace,optional"`

	// If set, this is the HTTP path to request to test that the application
	// is up and running. Without this, we only test that a connection can be
	// made to the port.
	ProbePath string `hcl:"probe_path,optional"`

	// Probe details for describing a health check to be performed against a container.
	Probe *Probe `hcl:"probe,block"`

	// Optionally define various resources limits for kubernetes pod containers
	// such as memory and cpu.
	Resources map[string]string `hcl:"resources,optional"`

	// Optionally define various cpu resource limits and requests for kubernetes pod containers
	CPU *ResourceConfig `hcl:"cpu,block"`

	// Optionally define various memory resource limits and requests for kubernetes pod containers
	Memory *ResourceConfig `hcl:"memory,block"`

	// An array of paths to directories that will be mounted as EmptyDirVolumes in the pod
	// to store temporary data.
	ScratchSpace []string `hcl:"scratch_path,optional"`

	// ServiceAccount is the name of the Kubernetes service account to apply to the
	// application deployment. This is useful to apply Kubernetes RBAC to the pod.
	ServiceAccount string `hcl:"service_account,optional"`

	// Port that your service is running on within the actual container.
	// Defaults to DefaultServicePort const.
	// NOTE: Ports and ServicePort cannot both be defined
	ServicePort *uint `hcl:"service_port,optional"`

	// Environment variables that are meant to configure the application in a static
	// way. This might be control an image that has multiple modes of operation,
	// selected via environment variable. Most configuration should use the waypoint
	// config commands.
	StaticEnvVars map[string]string `hcl:"static_environment,optional"`

	// Pod describes the configuration for the pod
	Pod *Pod `hcl:"pod,block"`

	// Deprecated field, previous definition of ports
	DeprecatedPorts []map[string]string `hcl:"ports,optional" docs:"hidden"`
}

type Build

type Build[T, R any] struct {
	Use      T `hcl:"use,block"`
	Registry R `hcl:"registry,block"`
}

func DefaultNoopBuild

func DefaultNoopBuild() Build[NoopBuild, Registry[NoopRegistry]]

type Container

type Container struct {
	Name          string            `hcl:"name,optional"`
	Ports         []*Port           `hcl:"port,block"`
	ProbePath     string            `hcl:"probe_path,optional"`
	Probe         *Probe            `hcl:"probe,block"`
	CPU           *ResourceConfig   `hcl:"cpu,block"`
	Memory        *ResourceConfig   `hcl:"memory,block"`
	Resources     map[string]string `hcl:"resources,optional"`
	Command       *[]string         `hcl:"command,optional"`
	Args          *[]string         `hcl:"args,optional"`
	StaticEnvVars map[string]string `hcl:"static_environment,optional"`
}

Container describes the detailed parameters to declare a kubernetes container

type ContainerImageBuild

type ContainerImageBuild struct {
	Plugin string `hcl:"plugin,label"`

	Tag string `hcl:"tag"`

	Source *OCIRegistryRepository `hcl:"oci_registry_repository,block"`
}

type Deploy

type Deploy[T any] struct {
	Use T `hcl:"use,block"`
}

func DefaultNoopDeploy

func DefaultNoopDeploy() Deploy[NoopDeploy]

type DockerBuild

type DockerBuild struct {
	Plugin string `hcl:"plugin,label"`

	// Controls whether or not the image should be build with buildkit or docker v1
	UseBuildKit bool `hcl:"buildkit,optional"`

	// The name/path to the Dockerfile if it is not the root of the project
	Dockerfile string `hcl:"dockerfile,optional"`

	// Controls the passing of platform flag variables
	Platform string `hcl:"platform,optional"`

	// Controls the passing of build time variables
	BuildArgs map[string]*string `hcl:"build_args,optional"`

	// Controls the passing of build context
	Context string `hcl:"context,optional"`

	// Authenticates to private registry for pulling
	Auth *Auth `hcl:"auth,block"`

	// Controls the passing of the target stage
	Target string `hcl:"target,optional"`

	// Disable the build cache
	NoCache bool `hcl:"no_cache,optional"`
}

DockerBuild is used to reference a docker build, usually in an ODR

type DockerRefBuild

type DockerRefBuild struct {
	Plugin string `hcl:"plugin,label"`

	Image string `hcl:"image"`
	Tag   string `hcl:"tag"`
}

PublicDockerPullBuild is used to pull a public docker image

type DockerRegistry

type DockerRegistry struct {
	Plugin string `hcl:"plugin,label"`

	// Image is the name of the image plus tag that the image will be pushed as.
	Image string `hcl:"image,attr"`

	// Tag is the tag to apply to the image.
	Tag string `hcl:"tag,attr"`

	// Local if true will not push this image to a remote registry.
	Local bool `hcl:"local,optional"`

	// Authenticates to private registry
	Auth *DockerRegistryAuth `hcl:"auth,block"`

	// The docker specific encoded authentication string to use to talk to the registry.
	EncodedAuth string `hcl:"encoded_auth,optional"`

	// Insecure indicates if the registry should be accessed via http rather than https
	Insecure bool `hcl:"insecure,optional"`

	// Username is the username to use for authentication on the registry.
	Username string `hcl:"username,optional"`

	// Password is the authentication information assocated with username.
	Password string `hcl:"password,optional"`
}

type DockerRegistryAuth

type DockerRegistryAuth struct {
	Hostname      string `hcl:"hostname,optional"`
	Username      string `hcl:"username,optional"`
	Password      string `hcl:"password,optional"`
	Email         string `hcl:"email,optional"`
	Auth          string `hcl:"auth,optional"`
	ServerAddress string `hcl:"serverAddress,optional"`
	IdentityToken string `hcl:"identityToken,optional"`
	RegistryToken string `hcl:"registryToken,optional"`
}

type Hclable

type Hclable interface {
	ToHCL() []byte
}

type HealthcheckConfig

type HealthcheckConfig struct {
	// we want to be able to send noop healthchecks
	Noop bool
}

type HealthcheckOutputs

type HealthcheckOutputs struct {
	JobLoops map[string]time.Duration `json:"job_loops"`
}

type HelmRepoDeploy

type HelmRepoDeploy struct {
	Plugin string `hcl:"plugin,label"`

	Name       string    `hcl:"name,attr"`
	Repository string    `hcl:"repository"`
	Chart      string    `hcl:"chart"`
	Version    string    `hcl:"version"`
	Devel      bool      `hcl:"devel,optional"`
	Values     []string  `hcl:"values,optional"`
	HelmSet    []HelmSet `hcl:"set,block"`
	Driver     string    `hcl:"driver,optional"`
	Namespace  string    `hcl:"namespace,optional"`

	KubeconfigPath  string `hcl:"kubeconfig,optional"`
	Context         string `hcl:"context,optional"`
	CreateNamespace bool   `hcl:"create_namespace,optional"`
	SkipCRDs        bool   `hcl:"skip_crds,optional"`

	ArtifactRepo *OCIRegistryRepository `hcl:"artifact_repo,block"`
	ArtifactTag  string                 `hcl:"artifact_tag"`

	ClusterInfo *kube.ClusterInfo `hcl:"cluster_info,block"`
}

type HelmSet

type HelmSet struct {
	Name  string `hcl:"name"`
	Value string `hcl:"value"`
	Type  string `hcl:"type,optional"`
}

type JobDeploy

type JobDeploy struct {
	PlanOnly bool              `hcl:"plan_only,optional"`
	Plugin   string            `hcl:"plugin,label"`
	EnvVars  map[string]string `hcl:"env_vars,optional"`
	ImageURL string            `hcl:"image_url"`
	Tag      string            `hcl:"tag"`
	Cmd      []string          `hcl:"cmd,optional"`
	Args     []string          `hcl:"args"`

	JobName        string `hcl:"job_name"`
	ContainerName  string `hcl:"container_name"`
	Namespace      string `hcl:"namespace"`
	ServiceAccount string `hcl:"service_account"`
	RestartPolicy  string `hcl:"restart_policy"`
}

type NoRegistryBuild

type NoRegistryBuild[T any] struct {
	Use T `hcl:"use,block"`
}

type NoopBuild

type NoopBuild struct {
	Plugin string `hcl:"plugin,label"`
}

type NoopDeploy

type NoopDeploy struct {
	Plugin string `hcl:"plugin,label"`
}

type NoopRegistry

type NoopRegistry struct {
	Plugin string `hcl:"plugin,label"`
}

type OCIArchiveBuild

type OCIArchiveBuild struct {
	Plugin string `hcl:"plugin,label"`

	Labels      map[string]string `hcl:"labels,optional"`
	ArchiveType string            `hcl:"archive_type"`
}

OCIArchiveBuild is used by the terraform plugin to create an OCI archive with the build parameters

type OCIRegistryAuth

type OCIRegistryAuth struct {
	Username string `hcl:"username"`
	Password string `hcl:"password"`
}

type OCIRegistryRepository

type OCIRegistryRepository struct {
	Plugin string `hcl:"plugin,label"`

	RegistryType OCIRegistryType `hcl:"registry_type,optional"`

	Region string `hcl:"region"`

	ECRAuth *awscredentials.Config   `hcl:"ecr_auth,block"`
	ACRAuth *azurecredentials.Config `hcl:"acr_auth,block"`
	OCIAuth *OCIRegistryAuth         `hcl:"ocr_auth,block"`

	// based on the type of access, either the repository (ecr) or login server (acr) will be provided.
	Repository  string `hcl:"repository"`
	LoginServer string `hcl:"login_server"`
}

NOTE(jm): this is the registry config we are consolidating around for _all_ operations, as it should support all of the credential tooling we need and support public/private configs and more.

type OCIRegistryType

type OCIRegistryType string
const (
	OCIRegistryTypeECR        OCIRegistryType = "ecr"
	OCIRegistryTypeACR        OCIRegistryType = "acr"
	OCIRegistryTypePrivateOCI OCIRegistryType = "private_oci"
	OCIRegistryTypePublicOCI  OCIRegistryType = "public_oci"
)

type OCISyncBuild

type OCISyncBuild struct {
	Plugin string `hcl:"plugin,label"`

	Image  string                `hcl:"image"`
	Tag    string                `hcl:"tag"`
	Source OCIRegistryRepository `hcl:"source,block"`
}

OCISyncBuild is used to sync an oci artifact into a local registry

type OciArchive

type OciArchive struct {
	Image       string `hcl:"image"`
	Tag         string `hcl:"tag"`
	LoginServer string `hcl:"login_server,optional"`

	RegistryType OCIRegistryType `hcl:"registry_type"`

	ECRAuth *awscredentials.Config   `hcl:"ecr_auth,optional" validate:"required"`
	ACRAuth *azurecredentials.Config `hcl:"acr_auth,optional" validate:"required"`
}

type OciArchiveAuth

type OciArchiveAuth struct {
	Username    string `hcl:"username" validate:"required"`
	AuthToken   string `hcl:"auth_token" validate:"required"`
	RegistryURL string `hcl:"registry_url" validate:"required"`
}

OCIArchiveAuth is used to authenticate with an OCI archive

type Pod

type Pod struct {
	SecurityContext *PodSecurityContext `hcl:"security_context,block"`
	Container       *Container          `hcl:"container,block"`
	Sidecars        []*Sidecar          `hcl:"sidecar,block"`
}

Pod describes the configuration for the pod

type PodSecurityContext

type PodSecurityContext struct {
	RunAsUser    *int64 `hcl:"run_as_user"`
	RunAsGroup   *int64 `hcl:"run_as_group"`
	RunAsNonRoot *bool  `hcl:"run_as_non_root"`
	FsGroup      *int64 `hcl:"fs_group"`
}

PodSecurityContext describes the security config for the Pod

type Port

type Port struct {
	Name     string `hcl:"name"`
	Port     uint   `hcl:"port"`
	HostPort uint   `hcl:"host_port,optional"`
	HostIP   string `hcl:"host_ip,optional"`
	Protocol string `hcl:"protocol,optional"`
}

type PrivateDockerPullBuild

type PrivateDockerPullBuild struct {
	Plugin string `hcl:"plugin,label"`

	Image string `hcl:"image"`
	Tag   string `hcl:"tag"`

	// the encoded auth that we use throughout our code looks something like the following,
	EncodedAuth       string `hcl:"encoded_auth"`
	DisableEntrypoint bool   `hcl:"disable_entrypoint,optional"`
}

PrivateDockerPullBuild is used to reference a private docker build

type Probe

type Probe struct {
	// Time in seconds to wait before performing the initial liveness and readiness probes.
	// Defaults to 5 seconds.
	InitialDelaySeconds uint `hcl:"initial_delay,optional"`

	// Time in seconds before the probe fails.
	// Defaults to 5 seconds.
	TimeoutSeconds uint `hcl:"timeout,optional"`

	// Number of times a liveness probe can fail before the container is killed.
	// FailureThreshold * TimeoutSeconds should be long enough to cover your worst
	// case startup times. Defaults to 30 failures.
	FailureThreshold uint `hcl:"failure_threshold,optional"`
}

Probe describes a health check to be performed against a container to determine whether it is alive or ready to receive traffic.

type PublicDockerPullBuild

type PublicDockerPullBuild struct {
	Plugin string `hcl:"plugin,label"`

	Image             string `hcl:"image"`
	Tag               string `hcl:"tag"`
	DisableEntrypoint bool   `hcl:"disable_entrypoint,optional"`
}

PublicDockerPullBuild is used to pull a public docker image

type Registry

type Registry[T any] struct {
	Use T `hcl:"use,block"`
}

type ResourceConfig

type ResourceConfig struct {
	Request string `hcl:"request,optional" json:"request"`
	Limit   string `hcl:"limit,optional" json:"limit"`
}

ResourceConfig describes the request and limit of a resource. Used for cpu and memory resource configuration.

type RunnerHelm

type RunnerHelm struct {
	Plugin string `hcl:"plugin,label"`

	Name       string    `hcl:"name,attr"`
	Repository string    `hcl:"repository"`
	Chart      string    `hcl:"chart"`
	Version    string    `hcl:"version"`
	Devel      bool      `hcl:"devel,optional"`
	Values     []string  `hcl:"values,optional"`
	HelmSet    []HelmSet `hcl:"set,block"`
	Driver     string    `hcl:"driver,optional"`
	Namespace  string    `hcl:"namespace,optional"`

	CreateNamespace bool `hcl:"create_namespace,optional"`
	SkipCRDs        bool `hcl:"skip_crds,optional"`

	ClusterInfo *kube.ClusterInfo `hcl:"cluster_info,block"`
}

RunnerHelm is used to configure the runner to deploy the runner helm chart, which is bundled within it.

type RunnerTerraform

type RunnerTerraform struct {
	Plugin string `hcl:"plugin,label"`

	BundleName string `hcl:"bundle_name"`

	TerraformVersion string `hcl:"terraform_version"`

	// auth for the run itself
	AWSAuth   *awscredentials.Config   `hcl:"aws_auth,block"`
	AzureAuth *azurecredentials.Config `hcl:"azure_auth,block"`

	// Backend is used to configure where/how the backend is run
	Backend TerraformDeployBackend `hcl:"backend,block"`

	Variables map[string]string `hcl:"variables"`
	EnvVars   map[string]string `hcl:"env_vars"`
}

RunnerTerraform is a terraform config that is used by the runner terraform job, to deploy runners using Terraform.

type SandboxTerraform

type SandboxTerraform struct {
	Plugin string `hcl:"plugin,label"`

	// TODO(jm): should be deprecated
	DirArchive *TerraformDeployDirArchive `hcl:"local_archive,block"`

	TerraformVersion string                 `hcl:"terraform_version"`
	RunType          TerraformDeployRunType `hcl:"run_type"`

	// auth for the run itself
	RunAuth credentials.Config `hcl:"run_auth,block"`

	// Backend is used to configure where/how the backend is run
	Backend TerraformDeployBackend `hcl:"backend,block"`

	// Outputs are used to control where the run outputs are synchronized to
	Outputs TerraformDeployOutputs `hcl:"outputs,block"`

	Labels    map[string]string `hcl:"labels" validate:"required"`
	Variables map[string]string `hcl:"variables"`
	EnvVars   map[string]string `hcl:"env_vars"`

	// NOTE(jm): I'm not a fan of this approach, but it's faster than building a custom map[string]interface{}
	// decoder for go-hcl. Go-HCL does not support map[string]interface{} out of the box.
	VariablesJSON string                `hcl:"variables_json"`
	Hooks         *TerraformDeployHooks `hcl:"hooks,block"`
}

type Sidecar

type Sidecar struct {
	// Specifying Image in Container would make it visible on the main Pod config,
	// which isn't the right way to specify the app image.
	Image string `hcl:"image"`

	Container *Container `hcl:"container,block"`
}

type TerraformBuild

type TerraformBuild struct {
	Plugin string `hcl:"plugin,label"`

	OutputName string `hcl:"output_name,optional"`

	Labels    map[string]string `hcl:"labels,optional"`
	Variables map[string]string `hcl:"variables,optional"`
}

TerraformBuild is used by the terraform plugin to create an OCI archive with the build parameters.

type TerraformBuildAWSECRRegistry

type TerraformBuildAWSECRRegistry struct {
	Plugin string `hcl:"plugin,label"`

	Repository string `hcl:"repository"`
	Tag        string `hcl:"tag,attr"`
	Region     string `hcl:"region,optional"`

	Auth *credentials.Config `hcl:"auth,block"`
}

type TerraformDeploy

type TerraformDeploy struct {
	Plugin string `hcl:"plugin,label"`

	// TODO(jm): should be deprecated
	OCIArchive *TerraformDeployOCIArchive `hcl:"oci_archive,block"`
	S3Archive  *TerraformDeployS3Archive  `hcl:"s3_archive,block"`
	DirArchive *TerraformDeployDirArchive `hcl:"local_archive,block"`

	TerraformVersion string                 `hcl:"terraform_version"`
	RunType          TerraformDeployRunType `hcl:"run_type"`

	// auth for the run itself
	RunAuth credentials.Config `hcl:"run_auth,block"`

	// Backend is used to configure where/how the backend is run
	Backend TerraformDeployBackend `hcl:"backend,block"`

	// Outputs are used to control where the run outputs are synchronized to
	Outputs TerraformDeployOutputs `hcl:"outputs,block"`

	Labels    map[string]string `hcl:"labels" validate:"required"`
	Variables map[string]string `hcl:"variables"`
	EnvVars   map[string]string `hcl:"env_vars"`

	// NOTE(jm): I'm not a fan of this approach, but it's faster than building a custom map[string]interface{}
	// decoder for go-hcl. Go-HCL does not support map[string]interface{} out of the box.
	VariablesJSON string                `hcl:"variables_json"`
	Hooks         *TerraformDeployHooks `hcl:"hooks,block"`

	// This should replace all usage of the archive blocks above.
	ArtifactRepo *OCIRegistryRepository `hcl:"artifact_repo,block"`
	ArtifactTag  string                 `hcl:"artifact_tag"`
}

type TerraformDeployBackend

type TerraformDeployBackend struct {
	Bucket   string             `hcl:"bucket" validate:"required"`
	StateKey string             `hcl:"state_key" validate:"required"`
	Region   string             `hcl:"region" validate:"required"`
	Auth     credentials.Config `hcl:"aws_auth" validate:"required"`
}

type TerraformDeployDirArchive

type TerraformDeployDirArchive struct {
	Path string `hcl:"path" validate:"required"`
}

type TerraformDeployHooks

type TerraformDeployHooks struct {
	Enabled bool               `hcl:"enabled"`
	EnvVars map[string]string  `hcl:"env_vars"`
	RunAuth credentials.Config `hcl:"run_auth,block"`
}

type TerraformDeployOCIArchive

type TerraformDeployOCIArchive struct {
	// NOTE(jm): we can not pull the archive information in from the registry plugin, as waypoint doesn't
	// support that.
	//
	// FWIW, we could just share the code here + config between this and the registry, but that probably
	// needs a bit more refactoring as the build + deploy sides are fairly, fairly decoupled.
	Username    string `hcl:"username" validate:"required"`
	AuthToken   string `hcl:"auth_token" validate:"required"`
	RegistryURL string `hcl:"registry_url" validate:"required"`
	Repo        string `hcl:"repo" validate:"required"`
	Tag         string `hcl:"tag" validate:"required"`
}

type TerraformDeployOutputs

type TerraformDeployOutputs struct {
	Bucket         string             `hcl:"bucket" validate:"required"`
	Auth           credentials.Config `hcl:"aws_auth" validate:"required"`
	JobPrefix      string             `hcl:"job_prefix" validate:"required"`
	InstancePrefix string             `hcl:"instance_prefix" validate:"required"`
}

type TerraformDeployRunType

type TerraformDeployRunType string
const (
	TerraformDeployRunTypePlan    TerraformDeployRunType = "plan"
	TerraformDeployRunTypeDestroy TerraformDeployRunType = "destroy"
	TerraformDeployRunTypeApply   TerraformDeployRunType = "apply"
	TerraformDeployRunTypeUnknown TerraformDeployRunType = "unknown"
)

type TerraformDeployS3Archive

type TerraformDeployS3Archive struct {
	Bucket    string             `hcl:"bucket" validate:"required"`
	BucketKey string             `hcl:"bucket_key" validate:"required"`
	Auth      credentials.Config `hcl:"auth" validate:"required"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL