Documentation ¶
Overview ¶
Package k8s contains components for deploying to Kubernetes.
Index ¶
- Constants
- Variables
- type Config
- type ConfigSourcer
- type Deployment
- type Platform
- func (p *Platform) Auth() error
- func (p *Platform) AuthFunc() interface{}
- func (p *Platform) Config() (interface{}, error)
- func (p *Platform) DefaultReleaserFunc() interface{}
- func (p *Platform) Deploy(ctx context.Context, log hclog.Logger, src *component.Source, ...) (*Deployment, error)
- func (p *Platform) DeployFunc() interface{}
- func (p *Platform) Destroy(ctx context.Context, log hclog.Logger, deployment *Deployment, ui terminal.UI) error
- func (p *Platform) DestroyFunc() interface{}
- func (p *Platform) Documentation() (*docs.Documentation, error)
- func (p *Platform) ValidateAuth() error
- func (p *Platform) ValidateAuthFunc() interface{}
- type Release
- func (*Release) Descriptor() ([]byte, []int)deprecated
- func (x *Release) GetServiceName() string
- func (x *Release) GetUrl() string
- func (*Release) ProtoMessage()
- func (x *Release) ProtoReflect() protoreflect.Message
- func (x *Release) Reset()
- func (x *Release) String() string
- func (r *Release) URL() string
- type Releaser
- func (r *Releaser) Config() (interface{}, error)
- func (r *Releaser) Destroy(ctx context.Context, log hclog.Logger, release *Release, ui terminal.UI) error
- func (r *Releaser) DestroyFunc() interface{}
- func (r *Releaser) Documentation() (*docs.Documentation, error)
- func (r *Releaser) Release(ctx context.Context, log hclog.Logger, src *component.Source, ui terminal.UI, ...) (*Release, error)
- func (r *Releaser) ReleaseFunc() interface{}
- type ReleaserConfig
Constants ¶
const DefaultPort = 80
The port that a service will forward to the pod(s)
const (
// TODO Evaluate if this should remain as a default 3000 to another port.
DefaultServicePort = 3000
)
Variables ¶
var File_waypoint_builtin_k8s_plugin_proto protoreflect.FileDescriptor
var Options = []sdk.Option{ sdk.WithComponents(&Platform{}, &Releaser{}, &ConfigSourcer{}), }
Options are the SDK options to use for instantiation for the Kubernetes plugin.
Functions ¶
This section is empty.
Types ¶
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"` // 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"` // A full resource of options to define ports for your service running on the container // Defaults to port 3000. Ports []map[string]string `hcl:"ports,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"` // Optionally define various resources limits for kubernetes pod containers // such as memory and cpu. Resources map[string]string `hcl:"resources,optional"` // A path to a directory that will be created for the service 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 mulitple modes of operation, // selected via environment variable. Most configuration should use the waypoint // config commands. StaticEnvVars map[string]string `hcl:"static_environment,optional"` }
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 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"` // 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) 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 Platform ¶
type Platform struct {
// contains filtered or unexported fields
}
Platform is the Platform implementation for Kubernetes.
func (*Platform) AuthFunc ¶
func (p *Platform) AuthFunc() interface{}
AuthFunc implements component.Authenticator
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, 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) ValidateAuth ¶
func (*Platform) ValidateAuthFunc ¶
func (p *Platform) ValidateAuthFunc() interface{}
ValidateAuthFunc implements component.Authenticator
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"` // contains filtered or unexported fields }
func (*Release) Descriptor
deprecated
func (*Release) GetServiceName ¶
func (*Release) ProtoMessage ¶
func (*Release) ProtoMessage()
func (*Release) ProtoReflect ¶
func (x *Release) ProtoReflect() protoreflect.Message
type Releaser ¶
type Releaser struct {
// contains filtered or unexported fields
}
Releaser is the ReleaseManager implementation for Kubernetes.
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, ui terminal.UI, target *Deployment, ) (*Release, error)
Release creates a Kubernetes service configured for the deployment
func (*Releaser) ReleaseFunc ¶
func (r *Releaser) ReleaseFunc() interface{}
ReleaseFunc implements component.ReleaseManager
type ReleaserConfig ¶
type ReleaserConfig struct { // 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.