protokube

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2018 License: Apache-2.0 Imports: 57 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// KubeProxyClusterRoleName sets the name for the kube-proxy ClusterRole
	KubeProxyClusterRoleName = "system:node-proxier"

	// Constants for what we name our ServiceAccounts with limited access to the cluster in case of RBAC
	KubeDNSServiceAccountName   = "kube-dns"
	KubeProxyServiceAccountName = "kube-proxy"
)

The below code should mirror the code in kubeadm. We'll develop it here then contribute it back once they are out of core - otherwise it is using the wrong version of the k8s client.

View Source
const TaintsAnnotationKey string = "scheduler.alpha.kubernetes.io/taints"

TaintsAnnotationKey represents the key of taints data (json serialized) in the Annotations of a Node. Note that this is for k8s <= 1.5 only

View Source
const VolStatusValue = "attached"
View Source
const VolumeMetaDataFile = "/vol-metadata/metadata.json"

Variables

View Source
var (
	// Containerized indicates the etcd is containerized
	Containerized = false
	// RootFS is the root fs path
	RootFS = "/"
)

Functions

func BuildEtcdManifest added in v1.10.0

func BuildEtcdManifest(c *EtcdCluster) *v1.Pod

BuildEtcdManifest creates the pod spec, based on the etcd cluster

func DebugString

func DebugString(o interface{}) string

func ExecuteTemplate

func ExecuteTemplate(key string, templateDefinition string, model interface{}) ([]byte, error)

ExecuteTemplate renders the specified template with the model

func GetDropletInternalIP added in v1.10.0

func GetDropletInternalIP() (net.IP, error)

GetDropletInternalIP gets the private IP of the droplet running this program This function is exported so it can be called from protokube

func NewNsEnterExec added in v1.10.0

func NewNsEnterExec() mount.Exec

NewNsEnterExec builds a mount.Exec implementation that nsenters into the host process It is very similar to mount.NewNsenterMounter, but execs into the host

Types

type AWSVolumes

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

AWSVolumes defines the aws volume implementation

func NewAWSVolumes

func NewAWSVolumes() (*AWSVolumes, error)

NewAWSVolumes returns a new aws volume provider

func (*AWSVolumes) AttachVolume

func (a *AWSVolumes) AttachVolume(volume *Volume) error

AttachVolume attaches the specified volume to this instance, returning the mountpoint & nil if successful

func (*AWSVolumes) ClusterID

func (a *AWSVolumes) ClusterID() string

func (*AWSVolumes) FindMountedVolume added in v1.10.0

func (v *AWSVolumes) FindMountedVolume(volume *Volume) (string, error)

FindMountedVolume implements Volumes::FindMountedVolume

func (*AWSVolumes) FindVolumes

func (a *AWSVolumes) FindVolumes() ([]*Volume, error)

func (*AWSVolumes) GossipSeeds added in v1.10.0

func (a *AWSVolumes) GossipSeeds() (gossip.SeedProvider, error)

func (*AWSVolumes) InstanceID added in v1.10.0

func (a *AWSVolumes) InstanceID() string

func (*AWSVolumes) InternalIP

func (a *AWSVolumes) InternalIP() net.IP

type ByEtcdClusterName added in v1.10.0

type ByEtcdClusterName []*Volume

ByEtcdClusterName sorts volumes so that we mount in a consistent order, and in addition we try to mount the main etcd volume before the events etcd volume

func (ByEtcdClusterName) Len added in v1.10.0

func (a ByEtcdClusterName) Len() int

func (ByEtcdClusterName) Less added in v1.10.0

func (a ByEtcdClusterName) Less(i, j int) bool

func (ByEtcdClusterName) Swap added in v1.10.0

func (a ByEtcdClusterName) Swap(i, j int)

type DNSProvider

type DNSProvider interface {
	Replace(fqdn string, values []string) error
	Run()
}

type DOVolumes added in v1.10.0

type DOVolumes struct {
	ClusterID string
	Cloud     *digitalocean.Cloud
	// contains filtered or unexported fields
}

func NewDOVolumes added in v1.10.0

func NewDOVolumes(clusterID string) (*DOVolumes, error)

func (*DOVolumes) AttachVolume added in v1.10.0

func (d *DOVolumes) AttachVolume(volume *Volume) error

func (*DOVolumes) FindMountedVolume added in v1.10.0

func (d *DOVolumes) FindMountedVolume(volume *Volume) (string, error)

func (*DOVolumes) FindVolumes added in v1.10.0

func (d *DOVolumes) FindVolumes() ([]*Volume, error)

type EtcdCluster

type EtcdCluster struct {
	// ClientPort is the incoming ports for client
	ClientPort int
	// ClusterName is the cluster name
	ClusterName string
	// ClusterToken is the cluster token
	ClusterToken string
	// CPURequest is the pod limits
	CPURequest resource.Quantity
	// DataDirName is the path to the data directory
	DataDirName string
	// ImageSource is the docker image to use
	ImageSource string
	// LogFile is the location of the logfile
	LogFile string
	// Me is the node that we will be in the cluster
	Me *EtcdNode
	// Nodes is a list of nodes in the cluster (including the self-node, Me)
	Nodes []*EtcdNode
	// PeerPort is the port for peers to connect
	PeerPort int
	// PodName is the name given to the pod
	PodName string
	// ProxyMode indicates we are running in proxy mode
	ProxyMode bool
	// Spec is the specification found from the volumes
	Spec *etcd.EtcdClusterSpec
	// VolumeMountPath is the mount path
	VolumeMountPath string
	// TLSAuth indicates we should enforce peer and client verification
	TLSAuth bool
	// TLSCA is the path to a client ca for etcd clients
	TLSCA string
	// TLSCert is the path to a client certificate for etcd
	TLSCert string
	// TLSKey is the path to a client private key for etcd
	TLSKey string
	// PeerCA is the path to a peer ca for etcd
	PeerCA string
	// PeerCert is the path to a peer ca for etcd
	PeerCert string
	// PeerKey is the path to a peer ca for etcd
	PeerKey string
	// ElectionTimeout is the leader election timeout
	ElectionTimeout string
	// HeartbeatInterval is the heartbeat interval
	HeartbeatInterval string
	// BackupImage is the image to use for backing up etcd
	BackupImage string
	// BackupStore is a VFS path for backing up etcd
	BackupStore string
}

EtcdCluster is the configuration for the etcd cluster

func (*EtcdCluster) String

func (c *EtcdCluster) String() string

String returns the debug string

type EtcdController

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

EtcdController defines the etcd controller

func (*EtcdController) RunSyncLoop

func (k *EtcdController) RunSyncLoop()

RunSyncLoop is responsible for managing the etcd sign loop

type EtcdNode

type EtcdNode struct {
	Name         string
	InternalName string
}

EtcdNode is a definition for the etcd node

func (*EtcdNode) String

func (e *EtcdNode) String() string

type GCEVolumes added in v1.10.0

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

GCEVolumes is the Volumes implementation for GCE

func NewGCEVolumes added in v1.10.0

func NewGCEVolumes() (*GCEVolumes, error)

NewGCEVolumes builds a GCEVolumes

func (*GCEVolumes) AttachVolume added in v1.10.0

func (v *GCEVolumes) AttachVolume(volume *Volume) error

AttachVolume attaches the specified volume to this instance, returning the mountpoint & nil if successful

func (*GCEVolumes) ClusterID added in v1.10.0

func (a *GCEVolumes) ClusterID() string

ClusterID implements Volumes ClusterID

func (*GCEVolumes) FindMountedVolume added in v1.10.0

func (v *GCEVolumes) FindMountedVolume(volume *Volume) (string, error)

FindMountedVolume implements Volumes::FindMountedVolume

func (*GCEVolumes) FindVolumes added in v1.10.0

func (v *GCEVolumes) FindVolumes() ([]*Volume, error)

func (*GCEVolumes) GossipSeeds added in v1.10.0

func (g *GCEVolumes) GossipSeeds() (gossip.SeedProvider, error)

func (*GCEVolumes) InstanceName added in v1.10.0

func (g *GCEVolumes) InstanceName() string

func (*GCEVolumes) InternalIP added in v1.10.0

func (a *GCEVolumes) InternalIP() net.IP

InternalIP implements Volumes InternalIP

func (*GCEVolumes) Project added in v1.10.0

func (a *GCEVolumes) Project() string

Project returns the current GCE project

type GossipDnsProvider added in v1.10.0

type GossipDnsProvider struct {
	DNSView *dns.DNSView
	Zone    dns.DNSZoneInfo
}

func (*GossipDnsProvider) Replace added in v1.10.0

func (p *GossipDnsProvider) Replace(fqdn string, values []string) error

func (*GossipDnsProvider) Run added in v1.10.0

func (p *GossipDnsProvider) Run()

type KopsDnsProvider added in v1.10.0

type KopsDnsProvider struct {
	DNSScope      dns.Scope
	DNSController *dns.DNSController
}

func (*KopsDnsProvider) Replace added in v1.10.0

func (p *KopsDnsProvider) Replace(fqdn string, values []string) error

func (*KopsDnsProvider) Run added in v1.10.0

func (p *KopsDnsProvider) Run()

type KubeBoot

type KubeBoot struct {
	// Channels is a list of channel to apply
	Channels []string
	// InitializeRBAC should be set to true if we should create the core RBAC roles
	InitializeRBAC bool
	// InternalDNSSuffix is the dns zone we are living in
	InternalDNSSuffix string
	// InternalIP is the internal ip address of the node
	InternalIP net.IP
	// ApplyTaints controls whether we set taints based on the master label
	ApplyTaints bool
	// DNS is the dns provider
	DNS DNSProvider
	// ModelDir is the model directory
	ModelDir string
	// Kubernetes is the context methods for kubernetes
	Kubernetes *KubernetesContext
	// Master indicates we are a master node
	Master bool

	// ManageEtcd is true if we should manage etcd.
	// Deprecated in favor of etcd-manager.
	ManageEtcd bool
	// EtcdBackupImage is the image to use for backing up etcd
	EtcdBackupImage string
	// EtcdBackupStore is the VFS path to which we should backup etcd
	EtcdBackupStore string
	// Etcd container registry location.
	EtcdImageSource string
	// EtcdElectionTimeout is the leader election timeout
	EtcdElectionTimeout string
	// EtcdHeartbeatInterval is the heartbeat interval
	EtcdHeartbeatInterval string
	// TLSAuth indicates we should enforce peer and client verification
	TLSAuth bool
	// TLSCA is the path to a client ca for etcd
	TLSCA string
	// TLSCert is the path to a tls certificate for etcd
	TLSCert string
	// TLSKey is the path to a tls private key for etcd
	TLSKey string
	// PeerCA is the path to a peer ca for etcd
	PeerCA string
	// PeerCert is the path to a peer certificate for etcd
	PeerCert string
	// PeerKey is the path to a peer private key for etcd
	PeerKey string
	// contains filtered or unexported fields
}

KubeBoot is the options for the protokube service

func (*KubeBoot) BuildInternalDNSName

func (k *KubeBoot) BuildInternalDNSName(key string) string

BuildInternalDNSName builds a DNS name for use inside the cluster, adding our internal DNS suffix to the key

func (*KubeBoot) CreateInternalDNSNameRecord

func (k *KubeBoot) CreateInternalDNSNameRecord(fqdn string) error

CreateInternalDNSNameRecord maps a FQDN to the internal IP address of the current machine

func (*KubeBoot) Init

func (k *KubeBoot) Init(volumesProvider Volumes)

Init is responsible for initializing the controllers

func (*KubeBoot) RunSyncLoop

func (k *KubeBoot) RunSyncLoop()

RunSyncLoop is responsible for provision the cluster

func (*KubeBoot) String

func (k *KubeBoot) String() string

type KubernetesContext

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

KubernetesContext is the kubernetes context

func NewKubernetesContext

func NewKubernetesContext() *KubernetesContext

NewKubernetesContext returns a new KubernetesContext

func (*KubernetesContext) KubernetesClient

func (c *KubernetesContext) KubernetesClient() (kubernetes.Interface, error)

KubernetesClient returns a new kubernetes api client

type VSphereVolumes added in v1.10.0

type VSphereVolumes struct{}

VSphereVolumes represents vSphere volume and implements Volumes interface.

func NewVSphereVolumes added in v1.10.0

func NewVSphereVolumes() (*VSphereVolumes, error)

NewVSphereVolumes returns instance of VSphereVolumes type.

func (*VSphereVolumes) AttachVolume added in v1.10.0

func (v *VSphereVolumes) AttachVolume(volume *Volume) error

AttachVolume attaches given volume. In case of vSphere, volumes are statically mounted, so no operation is performed.

func (*VSphereVolumes) FindMountedVolume added in v1.10.0

func (v *VSphereVolumes) FindMountedVolume(volume *Volume) (string, error)

FindMountedVolume implements Volumes::FindMountedVolume

func (*VSphereVolumes) FindVolumes added in v1.10.0

func (v *VSphereVolumes) FindVolumes() ([]*Volume, error)

FindVolumes returns Volume instances associated with this VSphereVolumes. EtcdClusterSpec is populated using vSphere volume metadata.

func (*VSphereVolumes) InternalIp added in v1.10.0

func (v *VSphereVolumes) InternalIp() net.IP

InternalIp returns IP of machine associated with this volume.

type Volume

type Volume struct {
	// ID is the cloud-provider identifier for the volume
	ID string

	// LocalDevice is set if the volume is attached to the local machine
	LocalDevice string

	// AttachedTo is set to the ID of the machine the volume is attached to, or "" if not attached
	AttachedTo string

	// Mountpoint is the path on which the volume is mounted, if mounted
	// It will likely be "/mnt/master-" + ID
	Mountpoint string

	// Status is a volume provider specific Status string; it makes it easier for the volume provider
	Status string

	Info VolumeInfo
}

func (*Volume) String

func (v *Volume) String() string

type VolumeInfo

type VolumeInfo struct {
	Description string
	//MasterID    int
	// TODO: Maybe the events cluster can just be a PetSet - do we need it for boot?
	EtcdClusters []*etcd.EtcdClusterSpec
}

func (*VolumeInfo) String

func (v *VolumeInfo) String() string

type VolumeMountController

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

type Volumes

type Volumes interface {
	AttachVolume(volume *Volume) error
	FindVolumes() ([]*Volume, error)

	// FindMountedVolume returns the device (e.g. /dev/sda) where the volume is mounted
	// If not found, it returns "", nil
	// On error, it returns "", err
	FindMountedVolume(volume *Volume) (device string, err error)
}

Jump to

Keyboard shortcuts

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