k8s

package
v0.5.38 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2023 License: MPL-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const TypeK8sCluster string = "k8s_cluster"

TypeK8sCluster is the resource string for a Cluster resource

View Source
const TypeK8sConfig string = "k8s_config"

TypeK8sConfig defines the string type for the Kubernetes config resource

Variables

This section is empty.

Functions

This section is empty.

Types

type ClusterProvider

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

K8sCluster defines a provider which can create Kubernetes clusters

func (*ClusterProvider) Changed

func (p *ClusterProvider) Changed() (bool, error)

func (*ClusterProvider) Create

func (p *ClusterProvider) Create() error

Create implements interface method to create a cluster of the specified type

func (*ClusterProvider) Destroy

func (p *ClusterProvider) Destroy() error

Destroy implements interface method to destroy a cluster

func (*ClusterProvider) ImportLocalDockerImages

func (p *ClusterProvider) ImportLocalDockerImages(name string, id string, images []ctypes.Image, force bool) error

ImportLocalDockerImages fetches Docker images stored on the local client and imports them into the cluster

func (*ClusterProvider) Init

func (*ClusterProvider) Lookup

func (p *ClusterProvider) Lookup() ([]string, error)

Lookup the a clusters current state

func (*ClusterProvider) Refresh

func (p *ClusterProvider) Refresh() error

type ConfigProvider

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

func (*ConfigProvider) Changed

func (p *ConfigProvider) Changed() (bool, error)

func (*ConfigProvider) Create

func (p *ConfigProvider) Create() error

Create the Kubernetes resources defined by the config

func (*ConfigProvider) Destroy

func (p *ConfigProvider) Destroy() error

Destroy the Kubernetes resources defined by the config

func (*ConfigProvider) Init

func (p *ConfigProvider) Init(cfg htypes.Resource, l logger.Logger) error

func (*ConfigProvider) Lookup

func (p *ConfigProvider) Lookup() ([]string, error)

Lookup the Kubernetes resources defined by the config

func (*ConfigProvider) Refresh

func (p *ConfigProvider) Refresh() error

type K8sCluster

type K8sCluster struct {
	// embedded type holding name, etc.
	types.ResourceMetadata `hcl:",remain"`

	Networks []ctypes.NetworkAttachment `hcl:"network,block" json:"networks,omitempty"` // Attach to the correct network // only when Image is specified

	Image   *ctypes.Image   `hcl:"image,block" json:"images,omitempty"` // optional image to use when creating the cluster
	Nodes   int             `hcl:"nodes,optional" json:"nodes,omitempty"`
	Volumes []ctypes.Volume `hcl:"volume,block" json:"volumes,omitempty"` // volumes to attach to the cluster

	// Images that will be copied from the local docker cache to the cluster
	CopyImages []ctypes.Image `hcl:"copy_image,block" json:"copy_images,omitempty"`

	Ports      []ctypes.Port      `hcl:"port,block" json:"ports,omitempty"`             // ports to expose
	PortRanges []ctypes.PortRange `hcl:"port_range,block" json:"port_ranges,omitempty"` // range of ports to expose

	Environment map[string]string `hcl:"environment,optional" json:"environment,omitempty"` // environment variables to set when starting the container

	// Path to the Kubernetes config
	KubeConfig string `hcl:"kubeconfig,optional" json:"kubeconfig,omitempty"`

	// Port the API server is running on
	APIPort int `hcl:"api_port,optional" json:"api_port,omitempty"`

	// Port the connector is running on
	ConnectorPort int `hcl:"connector_port,optional" json:"connector_port,omitempty"`

	// Fully qualified domain name for the container, this address can be
	// used to reference the container within docker and from other containers
	ContainerName string `hcl:"container_name,optional" json:"container_name,omitempty"`

	// ExternalIP is the ip address of the cluster, this generally resolves
	// to the docker ip
	ExternalIP string `hcl:"external_ip,optional" json:"external_ip,omitempty"`
}

K8sCluster is a config stanza which defines a Kubernetes or a Nomad cluster

func (*K8sCluster) Process

func (k *K8sCluster) Process() error

type K8sConfig

type K8sConfig struct {
	types.ResourceMetadata `hcl:",remain"`

	Cluster K8sCluster `hcl:"cluster" json:"cluster"`

	// Path of a file or directory of Kubernetes config files to apply
	Paths []string `hcl:"paths" validator:"filepath" json:"paths"`
	// WaitUntilReady when set to true waits until all resources have been created and are in a "Running" state
	WaitUntilReady bool `hcl:"wait_until_ready" json:"wait_until_ready"`

	// HealthCheck defines a health check for the resource
	HealthCheck *healthcheck.HealthCheckKubernetes `hcl:"health_check,block" json:"health_check,omitempty"`
}

K8sConfig applies and deletes and deletes Kubernetes configuration

func (*K8sConfig) Process

func (k *K8sConfig) Process() error

Jump to

Keyboard shortcuts

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