k8s

package
v0.11.2 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2023 License: MPL-2.0 Imports: 50 Imported by: 2

README

Getting Started

The Kubernetes plugin can deploy a Docker image of an application to Kubernetes, expose the Deployment with a Kubernetes Service, and source configuration from a Kubernetes Secret or ConfigMap. It also launches on-demand runners to do operations remotely.

Components

  1. Platform
  2. ReleaseManager
  3. ConfigSourcer
  4. TaskLauncher
  1. Docker

Resources

Platform
  1. Kubernetes Deployment
  2. Kubernetes Autoscaler
Release Manager
  1. Kubernetes Service
  2. Kubernetes Ingress

Documentation

Overview

Package k8s contains components for deploying to Kubernetes.

Index

Constants

View Source
const DefaultPort = 80

DefaultPort is the port that a service will forward to the pod(s)

View Source
const (
	DefaultServicePort = 3000
)

Variables

View Source
var File_waypoint_builtin_k8s_plugin_proto protoreflect.FileDescriptor

Options are the SDK options to use for instantiation for the Kubernetes plugin.

Functions

func Clientset added in v0.6.0

func Clientset(kubeconfig, context string) (*kubernetes.Clientset, string, *rest.Config, error)

Clientset returns a K8S clientset and configured namespace. This will attempt to use in-cluster auth if available if kubeconfig is not explicitly specified. Otherwise, this will fall back to out of cluster auth.

func ClientsetInCluster added in v0.6.0

func ClientsetInCluster() (*kubernetes.Clientset, string, *rest.Config, error)

ClientsetInCluster returns a K8S clientset and configured namespace for in-cluster usage.

func ClientsetOutOfCluster added in v0.6.0

func ClientsetOutOfCluster(kubeconfig, context string) (*kubernetes.Clientset, string, *rest.Config, error)

ClientsetOutOfCluster loads a Kubernetes clientset using only a kubeconfig.

Types

type AutoscaleConfig added in v0.6.0

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 Config

type Config struct {
	// 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"`
}

Config is the configuration structure for the Platform.

type ConfigSourcer added in v0.2.0

type ConfigSourcer struct {
	// contains filtered or unexported fields
}

ConfigSourcer implements component.ConfigSourcer for K8s

func (*ConfigSourcer) Documentation added in v0.2.0

func (cs *ConfigSourcer) Documentation() (*docs.Documentation, error)

func (*ConfigSourcer) ReadFunc added in v0.2.0

func (cs *ConfigSourcer) ReadFunc() interface{}

ReadFunc implements component.ConfigSourcer

func (*ConfigSourcer) StopFunc added in v0.2.0

func (cs *ConfigSourcer) StopFunc() interface{}

StopFunc implements component.ConfigSourcer

type Container added in v0.3.2

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 Deployment

type Deployment struct {
	Id            string         `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Name          string         `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
	ResourceState *opaqueany.Any `protobuf:"bytes,3,opt,name=resource_state,json=resourceState,proto3" json:"resource_state,omitempty"`
	// contains filtered or unexported fields
}

func (*Deployment) Descriptor deprecated

func (*Deployment) Descriptor() ([]byte, []int)

Deprecated: Use Deployment.ProtoReflect.Descriptor instead.

func (*Deployment) GetId

func (x *Deployment) GetId() string

func (*Deployment) GetName

func (x *Deployment) GetName() string

func (*Deployment) GetResourceState added in v0.4.0

func (x *Deployment) GetResourceState() *opaqueany.Any

func (*Deployment) ProtoMessage

func (*Deployment) ProtoMessage()

func (*Deployment) ProtoReflect

func (x *Deployment) ProtoReflect() protoreflect.Message

func (*Deployment) Reset

func (x *Deployment) Reset()

func (*Deployment) String

func (x *Deployment) String() string

type IngressConfig added in v0.6.0

type IngressConfig struct {
	// Annotations to be applied to the ingress service.
	Annotations map[string]string `hcl:"annotations,optional"`

	// Currently Waypoint only supports "HTTP" rule-backed ingress resources.
	// We include this stanza label in the future for when Kubernetes has other
	// kinds of rule types.
	ClassName string `hcl:",label"`

	// If set, this will configure the given ingress resources backend service
	// as the default service that accepts traffic if no route rules match from
	// the inbound request.
	// Defaults to false
	DefaultBackend bool `hcl:"default,optional"`

	// If set, this option will configure the ingress controller to accept
	// traffic from the defined hostname. IPs are not allowed, nor are `:` delimiters.
	// Wildcards are allowed to a certain extent. For more details, check out the
	// k8s go client package.
	Host string `hcl:"host,optional"`

	// Defines the kind of rule the path will be. Possible values are:
	// 'Exact', 'Prefix', and 'ImplementationSpecific'.
	// We believe most users expect a 'Prefix' type, so we default to 'Prefix' if
	// not specified.
	PathType string `hcl:"path_type,optional"`

	// Path represents a rule to route requests to. I.e. if an inbound request
	// matches a route like `/foo`, the ingress controller would see that this
	// resource is configured for that rule, and would route traffic to this
	// ingress resources service backend.
	Path string `hcl:"path,optional"`

	// TlsConfig is an optional config that users can set to enable HTTPS traffic
	TlsConfig *IngressTls `hcl:"tls,block"`
}

IngressConfig holds various options to configure an Ingress resource with during a release. It currently only spports 'http' based route rules.

type IngressTls added in v0.6.0

type IngressTls struct {
	// Hosts is a list of hosts included in the TLS certificate
	Hosts []string `hcl:"hosts,optional"`

	// SecretName references the name of the secret created inside Kubernetes
	// associated with the TLS certificate information. If cert-manager is used,
	// this name will refer to the secret cert-manager should create when generating
	// certficiates for the secret.
	SecretName string `hcl:"secret_name,optional"`
}

IngressTls holds options required to configure an ingress resource with TLS.

type Platform

type Platform struct {
	// contains filtered or unexported fields
}

Platform is the Platform implementation for Kubernetes.

func (*Platform) Auth

func (p *Platform) Auth() error

func (*Platform) AuthFunc

func (p *Platform) AuthFunc() interface{}

AuthFunc implements component.Authenticator

func (*Platform) Config

func (p *Platform) Config() (interface{}, error)

Config implements Configurable

func (*Platform) ConfigSet added in v0.6.0

func (p *Platform) ConfigSet(config interface{}) error

ConfigSet is called after a configuration has been decoded we can use this to validate the config

func (*Platform) DefaultReleaserFunc

func (p *Platform) DefaultReleaserFunc() interface{}

DefaultReleaserFunc implements component.PlatformReleaser

func (*Platform) Deploy

func (p *Platform) Deploy(
	ctx context.Context,
	log hclog.Logger,
	src *component.Source,
	img *docker.Image,
	deployConfig *component.DeploymentConfig,
	dcr *component.DeclaredResourcesResp,
	ui terminal.UI,
) (*Deployment, error)

Deploy deploys an image to Kubernetes.

func (*Platform) DeployFunc

func (p *Platform) DeployFunc() interface{}

DeployFunc implements component.Platform

func (*Platform) Destroy

func (p *Platform) Destroy(
	ctx context.Context,
	log hclog.Logger,
	deployment *Deployment,
	ui terminal.UI,
) error

Destroy deletes the K8S deployment.

func (*Platform) DestroyFunc

func (p *Platform) DestroyFunc() interface{}

DestroyFunc implements component.Destroyer

func (*Platform) Documentation

func (p *Platform) Documentation() (*docs.Documentation, error)

func (*Platform) Status added in v0.4.0

func (p *Platform) Status(
	ctx context.Context,
	log hclog.Logger,
	deployment *Deployment,
	ui terminal.UI,
) (*sdk.StatusReport, error)

func (*Platform) StatusFunc added in v0.4.0

func (p *Platform) StatusFunc() interface{}

func (*Platform) ValidateAuth

func (p *Platform) ValidateAuth() error

func (*Platform) ValidateAuthFunc

func (p *Platform) ValidateAuthFunc() interface{}

ValidateAuthFunc implements component.Authenticator

type Pod added in v0.3.2

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 added in v0.3.2

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 added in v0.6.0

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 Probe added in v0.3.0

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 Release

type Release struct {

	// service_name is the name of the service in Kubernetes
	ServiceName   string         `protobuf:"bytes,2,opt,name=service_name,json=serviceName,proto3" json:"service_name,omitempty"`
	Url           string         `protobuf:"bytes,1,opt,name=Url,proto3" json:"Url,omitempty"`
	ResourceState *opaqueany.Any `protobuf:"bytes,3,opt,name=resource_state,json=resourceState,proto3" json:"resource_state,omitempty"`
	// contains filtered or unexported fields
}

func (*Release) Descriptor deprecated

func (*Release) Descriptor() ([]byte, []int)

Deprecated: Use Release.ProtoReflect.Descriptor instead.

func (*Release) GetResourceState added in v0.5.0

func (x *Release) GetResourceState() *opaqueany.Any

func (*Release) GetServiceName

func (x *Release) GetServiceName() string

func (*Release) GetUrl

func (x *Release) GetUrl() string

func (*Release) ProtoMessage

func (*Release) ProtoMessage()

func (*Release) ProtoReflect

func (x *Release) ProtoReflect() protoreflect.Message

func (*Release) Reset

func (x *Release) Reset()

func (*Release) String

func (x *Release) String() string

func (*Release) URL

func (r *Release) URL() string

type Releaser

type Releaser struct {
	// contains filtered or unexported fields
}

Releaser is the ReleaseManager implementation for Kubernetes.

func (*Releaser) Config

func (r *Releaser) Config() (interface{}, error)

Config implements Configurable

func (*Releaser) Destroy

func (r *Releaser) Destroy(
	ctx context.Context,
	log hclog.Logger,
	release *Release,
	ui terminal.UI,
) error

Destroy deletes the K8S deployment.

func (*Releaser) DestroyFunc

func (r *Releaser) DestroyFunc() interface{}

DestroyFunc implements component.Destroyer

func (*Releaser) Documentation

func (r *Releaser) Documentation() (*docs.Documentation, error)

func (*Releaser) Release

func (r *Releaser) Release(
	ctx context.Context,
	log hclog.Logger,
	src *component.Source,
	job *component.JobInfo,
	ui terminal.UI,
	target *Deployment,
	dcr *component.DeclaredResourcesResp,
) (*Release, error)

Release creates a Kubernetes service configured for the deployment

func (*Releaser) ReleaseFunc

func (r *Releaser) ReleaseFunc() interface{}

ReleaseFunc implements component.ReleaseManager

func (*Releaser) Status added in v0.4.0

func (r *Releaser) Status(
	ctx context.Context,
	log hclog.Logger,
	release *Release,
	ui terminal.UI,
) (*sdk.StatusReport, error)

func (*Releaser) StatusFunc added in v0.4.0

func (r *Releaser) StatusFunc() interface{}

StatusFunc implements component.Status

type ReleaserConfig

type ReleaserConfig struct {
	// Annotations to be applied to the kube service.
	Annotations map[string]string `hcl:"annotations,optional"`

	// Ingress represents an config for setting up an ingress resource.
	IngressConfig *IngressConfig `hcl:"ingress,block"`

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

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

	// Load Balancer sets whether or not the service will be a load
	// balancer type service
	LoadBalancer bool `hcl:"load_balancer,optional"`

	// Port configures the port that is used to access the service.
	// The default is 80.
	// Not valid if `Ports` is already defined
	// If defined, will internally be stored into `Ports`
	Port uint `hcl:"port,optional"`

	// A full resource of options to define ports for a service
	Ports []map[string]string `hcl:"ports,optional"`

	// NodePort configures a port to access the service on whichever node
	// is running service.
	// Not valid if `Ports` is already defined
	// If defined, will internally be stored into `Ports`
	NodePort uint `hcl:"node_port,optional"`

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

ReleaserConfig is the configuration structure for the Releaser.

type Resource added in v0.4.0

type Resource struct {
	// contains filtered or unexported fields
}

Resource contains the internal resource states.

func (*Resource) Descriptor deprecated added in v0.4.0

func (*Resource) Descriptor() ([]byte, []int)

Deprecated: Use Resource.ProtoReflect.Descriptor instead.

func (*Resource) ProtoMessage added in v0.4.0

func (*Resource) ProtoMessage()

func (*Resource) ProtoReflect added in v0.4.0

func (x *Resource) ProtoReflect() protoreflect.Message

func (*Resource) Reset added in v0.4.0

func (x *Resource) Reset()

func (*Resource) String added in v0.4.0

func (x *Resource) String() string

type ResourceConfig added in v0.6.0

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 Resource_Autoscale added in v0.6.0

type Resource_Autoscale struct {

	// represents a horizontal pod autoscaler, if requested to be created
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	// contains filtered or unexported fields
}

func (*Resource_Autoscale) Descriptor deprecated added in v0.6.0

func (*Resource_Autoscale) Descriptor() ([]byte, []int)

Deprecated: Use Resource_Autoscale.ProtoReflect.Descriptor instead.

func (*Resource_Autoscale) GetName added in v0.6.0

func (x *Resource_Autoscale) GetName() string

func (*Resource_Autoscale) ProtoMessage added in v0.6.0

func (*Resource_Autoscale) ProtoMessage()

func (*Resource_Autoscale) ProtoReflect added in v0.6.0

func (x *Resource_Autoscale) ProtoReflect() protoreflect.Message

func (*Resource_Autoscale) Reset added in v0.6.0

func (x *Resource_Autoscale) Reset()

func (*Resource_Autoscale) String added in v0.6.0

func (x *Resource_Autoscale) String() string

type Resource_Deployment added in v0.4.0

type Resource_Deployment struct {
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	// contains filtered or unexported fields
}

func (*Resource_Deployment) Descriptor deprecated added in v0.4.0

func (*Resource_Deployment) Descriptor() ([]byte, []int)

Deprecated: Use Resource_Deployment.ProtoReflect.Descriptor instead.

func (*Resource_Deployment) GetName added in v0.4.0

func (x *Resource_Deployment) GetName() string

func (*Resource_Deployment) ProtoMessage added in v0.4.0

func (*Resource_Deployment) ProtoMessage()

func (*Resource_Deployment) ProtoReflect added in v0.4.0

func (x *Resource_Deployment) ProtoReflect() protoreflect.Message

func (*Resource_Deployment) Reset added in v0.4.0

func (x *Resource_Deployment) Reset()

func (*Resource_Deployment) String added in v0.4.0

func (x *Resource_Deployment) String() string

type Resource_Ingress added in v0.6.0

type Resource_Ingress struct {
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	// contains filtered or unexported fields
}

func (*Resource_Ingress) Descriptor deprecated added in v0.6.0

func (*Resource_Ingress) Descriptor() ([]byte, []int)

Deprecated: Use Resource_Ingress.ProtoReflect.Descriptor instead.

func (*Resource_Ingress) GetName added in v0.6.0

func (x *Resource_Ingress) GetName() string

func (*Resource_Ingress) ProtoMessage added in v0.6.0

func (*Resource_Ingress) ProtoMessage()

func (*Resource_Ingress) ProtoReflect added in v0.6.0

func (x *Resource_Ingress) ProtoReflect() protoreflect.Message

func (*Resource_Ingress) Reset added in v0.6.0

func (x *Resource_Ingress) Reset()

func (*Resource_Ingress) String added in v0.6.0

func (x *Resource_Ingress) String() string

type Resource_Service added in v0.5.0

type Resource_Service struct {
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	// contains filtered or unexported fields
}

func (*Resource_Service) Descriptor deprecated added in v0.5.0

func (*Resource_Service) Descriptor() ([]byte, []int)

Deprecated: Use Resource_Service.ProtoReflect.Descriptor instead.

func (*Resource_Service) GetName added in v0.5.0

func (x *Resource_Service) GetName() string

func (*Resource_Service) ProtoMessage added in v0.5.0

func (*Resource_Service) ProtoMessage()

func (*Resource_Service) ProtoReflect added in v0.5.0

func (x *Resource_Service) ProtoReflect() protoreflect.Message

func (*Resource_Service) Reset added in v0.5.0

func (x *Resource_Service) Reset()

func (*Resource_Service) String added in v0.5.0

func (x *Resource_Service) String() string

type Sidecar added in v0.6.0

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 TaskInfo added in v0.6.0

type TaskInfo struct {
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	// contains filtered or unexported fields
}

This represents the state of the TaskLaunch implementation.

func (*TaskInfo) Descriptor deprecated added in v0.6.0

func (*TaskInfo) Descriptor() ([]byte, []int)

Deprecated: Use TaskInfo.ProtoReflect.Descriptor instead.

func (*TaskInfo) GetId added in v0.6.0

func (x *TaskInfo) GetId() string

func (*TaskInfo) ProtoMessage added in v0.6.0

func (*TaskInfo) ProtoMessage()

func (*TaskInfo) ProtoReflect added in v0.6.0

func (x *TaskInfo) ProtoReflect() protoreflect.Message

func (*TaskInfo) Reset added in v0.6.0

func (x *TaskInfo) Reset()

func (*TaskInfo) String added in v0.6.0

func (x *TaskInfo) String() string

type TaskLauncher added in v0.6.0

type TaskLauncher struct {
	// contains filtered or unexported fields
}

TaskLauncher implements the TaskLauncher plugin interface to support launching on-demand tasks for the Waypoint server.

func (*TaskLauncher) Config added in v0.6.0

func (p *TaskLauncher) Config() (interface{}, error)

Config implements Configurable

func (*TaskLauncher) Documentation added in v0.6.0

func (p *TaskLauncher) Documentation() (*docs.Documentation, error)

func (*TaskLauncher) StartTask added in v0.6.0

func (p *TaskLauncher) StartTask(
	ctx context.Context,
	log hclog.Logger,
	tli *component.TaskLaunchInfo,
) (*TaskInfo, error)

StartTask creates a docker container for the task.

func (*TaskLauncher) StartTaskFunc added in v0.6.0

func (p *TaskLauncher) StartTaskFunc() interface{}

StartTaskFunc implements component.TaskLauncher

func (*TaskLauncher) StopTask added in v0.6.0

func (p *TaskLauncher) StopTask(
	ctx context.Context,
	log hclog.Logger,
	ti *TaskInfo,
) error

StopTask signals to Kubernetes to stop the container created previously

func (*TaskLauncher) StopTaskFunc added in v0.6.0

func (p *TaskLauncher) StopTaskFunc() interface{}

StopTaskFunc implements component.TaskLauncher

func (*TaskLauncher) WatchTask added in v0.9.0

func (p *TaskLauncher) WatchTask(
	ctx context.Context,
	log hclog.Logger,
	ui terminal.UI,
	ti *TaskInfo,
) (*component.TaskResult, error)

WatchTask implements TaskLauncher

func (*TaskLauncher) WatchTaskFunc added in v0.9.0

func (p *TaskLauncher) WatchTaskFunc() interface{}

WatchTaskFunc implements component.TaskLauncher

type TaskLauncherConfig added in v0.6.0

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

	// KubeconfigPath is the path to the kubeconfig file. If this is
	// blank then we default to the home directory. If we are running within
	// a pod, we will use the service account authentication if available if
	// this isn't set.
	KubeconfigPath string `hcl:"kubeconfig,optional"`

	// The name of the Kubernetes secret to use to pull images started by
	// this task.
	ImageSecret string `hcl:"image_secret,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"`

	// Set an explicit pull policy for this task launching. By default
	// we use "PullIfNotPresent" unless the image tag is "latest" when we
	// use "Always".
	PullPolicy string `hcl:"image_pull_policy,optional"`

	// The namespace to use for launching this task in Kubernetes
	Namespace string `hcl:"namespace,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"`

	// Optionally define various ephemeral storage resource limits and requests for kubernetes pod containers
	EphemeralStorage *ResourceConfig `hcl:"ephemeral_storage,block"`

	// How long WatchTask should wait for a pod to startup. This option is specifically
	// wordy because it's only for the WatchTask timing out waiting for the pod
	// its watching to start up before it attempts to stream its logs.
	WatchTaskStartupTimeoutSeconds int `hcl:"watchtask_startup_timeout_seconds,optional"`

	// The PodSecurityContext to apply to the pod
	SecurityContext *PodSecurityContext `hcl:"security_context,block"`
}

TaskLauncherConfig is the configuration structure for the task plugin.

Directories

Path Synopsis
internal
k8sstatus
Package k8sstatus implements helpers for building Waypoint status reports for Kubernetes resources.
Package k8sstatus implements helpers for building Waypoint status reports for Kubernetes resources.
manifest
Package manifest provides helpers to parse a Kubernetes "manifest" or multi-resource YAML document.
Package manifest provides helpers to parse a Kubernetes "manifest" or multi-resource YAML document.

Jump to

Keyboard shortcuts

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