Documentation
¶
Index ¶
- Constants
- func NewHetzner(token string) *rest.Client
- func NewK3s() *rest.Client
- func NewKubernetes() *rest.Client
- func VersionMax(a, b *semver.Version) *semver.Version
- func VersionMin(a, b *semver.Version) *semver.Version
- type Actions
- type Cluster
- type ClusterActions
- func (c ClusterActions) Await(resourceType string, resourceId int) error
- func (c ClusterActions) CreateServer(name string, serverType string, image string, location string, ...) (cloudId string, clusterIP string, err error)
- func (c ClusterActions) DeleteNode(node NodeStatus) error
- func (c ClusterActions) DeleteServer(node NodeStatus) (notFound bool)
- func (c ClusterActions) DrainNode(node NodeStatus) error
- func (c ClusterActions) GetBootstrapServer(name string, apiServer bool, kubernetesVersion *semver.Version) (*NodeStatus, error)
- func (c ClusterActions) GetClusterList() (*ClusterList, error)
- func (c ClusterActions) GetKubernetesNode(node NodeStatus) (*NodeResource, error)
- func (c ClusterActions) GetReleaseChannels() (ReleaseChannelStatuses, error)
- func (c ClusterActions) GetSshKeyIds() (keyIds []int, err error)
- func (c ClusterActions) SaveStatus(clusterName string, status *ClusterStatus) error
- type ClusterList
- type ClusterNetworkStatus
- type ClusterStatus
- type Clusters
- type CreateHetznerServerRequest
- type Filter
- type HetznerAction
- type HetznerActionError
- type HetznerActionResource
- type HetznerActionsResponse
- type HetznerFirewallRef
- type HetznerNetwork
- type HetznerServerRef
- type HetznerServerResponse
- type HetznerServerResult
- type HetznerServersResponse
- type HetznerSshKey
- type HetznerSshKeys
- type K3sReleaseChannelsResponse
- type Metadata
- type NodeResource
- type NodeResourceCondition
- type NodeResourceSpec
- type NodeResourceStatus
- type NodeSetSpec
- type NodeSetStatus
- type NodeSetStatuses
- type NodeSetsSpec
- type NodeStatus
- type NodeStatusRefs
- type NodeStatuses
- type Phase
- type PhaseChange
- type PhaseChanges
- type PodEviction
- type PodEvictionMetadata
- type PodMetadata
- type PodOwnerReference
- type PodResource
- type PodResourceList
- type ReleaseChannelStatus
- type ReleaseChannelStatuses
- type Spec
- type VersionRange
- type VersionStatus
- type VersionsSpec
Constants ¶
View Source
const ( Create = Phase("create") // signal to start provisioning process Creating = Phase("creating") // Cloud API has been called to create node, attach firewall and network, store SSH key - probe until SSH login works and cloud-init status --format=json has status: done then move to Installing Updating = Phase("updating") // have logged in, running apt update, apt upgrade, reboot, wait until it disconnects for reboot then go to installing phase Installing = Phase("installing") // probe until SSH login works, install K3s using secret, disconnect, wait for Node resource to appear Joining = Phase("joining") // wait for Node resource to reach Active state (is this step worth having separate from previous? might help with recovering from crash?) Active = Phase("active") // node is ready and working - this is the main lifecycle phase Replace = Phase("replace") // node needs to be replaced Delete = Phase("delete") // signal to start deletion process Draining = Phase("draining") // when repair sees unhealthy node, it tells K8s to drain and enters this state Deleting = Phase("deleting") // when node has been in draining state for 5 minutes, repair tells Hetzner to delete the server Deleted = Phase("deleted") // server has been deleted from cloud )
Variables ¶
This section is empty.
Functions ¶
func NewHetzner ¶
func NewKubernetes ¶
Types ¶
type Actions ¶
type Actions interface { GetBootstrapServer(name string, apiServer bool, kubernetesVersion *semver.Version) (*NodeStatus, error) GetReleaseChannels() (ReleaseChannelStatuses, error) CreateServer(name string, serverType string, image string, location string, privateNetworkId string, firewallIds []string, labels label.Labels, sshKeyIds []int, cloudInit string) (cloudId string, clusterIP string, err error) DeleteServer(node NodeStatus) (notFound bool) DrainNode(node NodeStatus) error GetKubernetesNode(node NodeStatus) (*NodeResource, error) DeleteNode(node NodeStatus) error SaveStatus(clusterName string, clusterStatus *ClusterStatus) error GetSshKeyIds() ([]int, error) }
type Cluster ¶
type Cluster struct { ApiVersion string `json:"apiVersion,omitempty" yaml:"apiVersion"` Kind string `json:"kind,omitempty"` Metadata *Metadata `json:"metadata,omitempty"` Spec *Spec `json:"spec,omitempty"` Status *ClusterStatus `json:"status,omitempty"` }
func (*Cluster) CreateNodeSetStatusesIfNecessary ¶
func (c *Cluster) CreateNodeSetStatusesIfNecessary()
type ClusterActions ¶
type ClusterActions struct {
// contains filtered or unexported fields
}
func NewClusterClient ¶
func NewClusterClient() *ClusterActions
func (ClusterActions) Await ¶
func (c ClusterActions) Await(resourceType string, resourceId int) error
func (ClusterActions) CreateServer ¶
func (ClusterActions) DeleteNode ¶
func (c ClusterActions) DeleteNode(node NodeStatus) error
func (ClusterActions) DeleteServer ¶
func (c ClusterActions) DeleteServer(node NodeStatus) (notFound bool)
func (ClusterActions) DrainNode ¶
func (c ClusterActions) DrainNode(node NodeStatus) error
func (ClusterActions) GetBootstrapServer ¶
func (c ClusterActions) GetBootstrapServer(name string, apiServer bool, kubernetesVersion *semver.Version) (*NodeStatus, error)
func (ClusterActions) GetClusterList ¶
func (c ClusterActions) GetClusterList() (*ClusterList, error)
func (ClusterActions) GetKubernetesNode ¶
func (c ClusterActions) GetKubernetesNode(node NodeStatus) (*NodeResource, error)
func (ClusterActions) GetReleaseChannels ¶
func (c ClusterActions) GetReleaseChannels() (ReleaseChannelStatuses, error)
func (ClusterActions) GetSshKeyIds ¶
func (c ClusterActions) GetSshKeyIds() (keyIds []int, err error)
func (ClusterActions) SaveStatus ¶
func (c ClusterActions) SaveStatus(clusterName string, status *ClusterStatus) error
type ClusterList ¶
type ClusterList struct {
Items Clusters `json:"items"`
}
type ClusterNetworkStatus ¶
type ClusterStatus ¶
type ClusterStatus struct { Versions *VersionStatus `json:"versions"` ClusterNetwork ClusterNetworkStatus `json:"clusterNetwork"` NodeSetStatuses `json:"nodeSets,omitempty"` }
func (*ClusterStatus) Find ¶
func (c *ClusterStatus) Find(filters ...Filter) (nodes NodeStatusRefs)
func (*ClusterStatus) UpdateVersionRanges ¶
func (c *ClusterStatus) UpdateVersionRanges()
type CreateHetznerServerRequest ¶
type CreateHetznerServerRequest struct { Name string `json:"name"` ServerType string `json:"server_type"` Image string `json:"image"` Location string `json:"location,omitempty"` Networks []int `json:"networks,omitempty"` Firewalls []HetznerFirewallRef `json:"firewalls,omitempty"` Labels map[string]string `json:"labels,omitempty"` SshKeys []int `json:"ssh_keys,omitempty"` CloudInit string `json:"user_data,omitempty"` }
type HetznerAction ¶
type HetznerAction struct { Command string `json:"command"` Status string `json:"status"` Error HetznerActionError `json:"error"` Started time.Time `json:"started"` Finished time.Time `json:"finished"` Resources []HetznerActionResource `json:"resources"` }
type HetznerActionError ¶
type HetznerActionResource ¶
type HetznerActionsResponse ¶
type HetznerActionsResponse struct {
Actions []HetznerAction `json:"actions"`
}
type HetznerFirewallRef ¶
type HetznerFirewallRef struct {
Firewall int `json:"firewall"`
}
type HetznerNetwork ¶
type HetznerServerRef ¶
type HetznerServerRef struct { Id int `json:"id"` PrivateNet []HetznerNetwork `json:"private_net"` }
type HetznerServerResponse ¶
type HetznerServerResponse struct { Id int `json:"id"` Created time.Time `json:"created"` Datacenter struct { Location struct { Name string `json:"name"` } `json:"location"` } `json:"datacenter"` Image struct { Name string `json:"name"` } `json:"image"` PrivateNets []HetznerNetwork `json:"private_net"` ServerType struct { Name string `json:"name"` } `json:"server_type"` }
type HetznerServerResult ¶
type HetznerServerResult struct {
Server HetznerServerRef `json:"server"`
}
type HetznerServersResponse ¶
type HetznerServersResponse struct {
Servers []HetznerServerResponse `json:"servers"`
}
type HetznerSshKey ¶
type HetznerSshKeys ¶
type HetznerSshKeys struct {
SshKeys []HetznerSshKey `json:"ssh_keys,omitempty"`
}
type K3sReleaseChannelsResponse ¶
type K3sReleaseChannelsResponse struct {
Data ReleaseChannelStatuses `json:"data"`
}
type NodeResource ¶
type NodeResource struct { Spec *NodeResourceSpec `json:"spec,omitempty"` Status *NodeResourceStatus `json:"status,omitempty"` }
func (NodeResource) IsReady ¶
func (n NodeResource) IsReady() bool
type NodeResourceCondition ¶
type NodeResourceSpec ¶
type NodeResourceSpec struct {
Unschedulable bool `json:"unschedulable,omitempty"`
}
type NodeResourceStatus ¶
type NodeResourceStatus struct {
Conditions []NodeResourceCondition `json:"conditions,omitempty"`
}
type NodeSetSpec ¶
type NodeSetSpec struct { Name string `json:"name"` ApiServer bool `json:"apiServer" yaml:"apiServer"` Replicas int `json:"replicas"` ServerType string `json:"serverType" yaml:"serverType"` Locations []string `json:"locations,omitempty"` }
func (*NodeSetSpec) ServerName ¶
func (n *NodeSetSpec) ServerName(clusterName string, generation int) string
type NodeSetStatus ¶
type NodeSetStatus struct { Name string `json:"name"` Generation int `json:"generation"` NodeStatuses `json:"nodes,omitempty"` }
func (*NodeSetStatus) Repair ¶
func (n *NodeSetStatus) Repair(cluster *Cluster)
type NodeSetStatuses ¶
type NodeSetStatuses []*NodeSetStatus
func (*NodeSetStatuses) CreateIfNecessary ¶
func (n *NodeSetStatuses) CreateIfNecessary(spec *NodeSetSpec)
func (NodeSetStatuses) Named ¶
func (n NodeSetStatuses) Named(name string) *NodeSetStatus
type NodeSetsSpec ¶
type NodeSetsSpec []*NodeSetSpec
func (NodeSetsSpec) FirstApiServerNodeSet ¶
func (n NodeSetsSpec) FirstApiServerNodeSet() *NodeSetSpec
func (NodeSetsSpec) Named ¶
func (n NodeSetsSpec) Named(name string) NodeSetSpec
type NodeStatus ¶
type NodeStatus struct { Name string `json:"name"` ServerType string `json:"serverType"` Location string `json:"location"` CloudId string `json:"cloudId,omitempty"` ClusterIP string `json:"clusterIP,omitempty"` BaseImage string `json:"baseImage,omitempty"` ApiServer bool `json:"apiServer,omitempty"` Version *semver.Version `json:"version,omitempty"` JoinEndpoint string `json:"joinEndpoint,omitempty"` Phases PhaseChanges `json:"phases,omitempty"` }
func (*NodeStatus) MakeProgress ¶
func (n *NodeStatus) MakeProgress(cluster *Cluster, actions Actions)
func (*NodeStatus) SetPhase ¶
func (n *NodeStatus) SetPhase(phase Phase, reason string)
type NodeStatusRefs ¶
type NodeStatusRefs []*NodeStatus
func (NodeStatusRefs) GetVersionRange ¶
func (n NodeStatusRefs) GetVersionRange() (v VersionRange)
func (NodeStatusRefs) MakeProgress ¶
func (n NodeStatusRefs) MakeProgress(cluster *Cluster, actions Actions)
func (NodeStatusRefs) SetPhase ¶
func (n NodeStatusRefs) SetPhase(phase Phase, reason string)
func (NodeStatusRefs) SortByPhase ¶
func (n NodeStatusRefs) SortByPhase()
func (NodeStatusRefs) SortByRecency ¶
func (n NodeStatusRefs) SortByRecency()
SortByRecency returns most recent first
type NodeStatuses ¶
type NodeStatuses []*NodeStatus
func (*NodeStatuses) AddNode ¶
func (n *NodeStatuses) AddNode(node *NodeStatus)
func (*NodeStatuses) Find ¶
func (n *NodeStatuses) Find(filters ...Filter) (nodes NodeStatusRefs)
type PhaseChange ¶
type PhaseChanges ¶
type PhaseChanges []PhaseChange
func (PhaseChanges) Current ¶
func (p PhaseChanges) Current() PhaseChange
type PodEviction ¶
type PodEviction struct { ApiVersion string `json:"apiVersion"` Kind string `json:"kind"` Metadata PodEvictionMetadata `json:"metadata,omitempty"` }
type PodEvictionMetadata ¶
type PodMetadata ¶
type PodMetadata struct { Name string `json:"name,omitempty"` Namespace string `json:"namespace,omitempty"` OwnerReferences []*PodOwnerReference `json:"ownerReferences,omitempty"` }
type PodOwnerReference ¶
type PodResource ¶
type PodResource struct {
Metadata *PodMetadata `json:"metadata,omitempty"`
}
type PodResourceList ¶
type PodResourceList struct {
Items []PodResource `json:"items"`
}
type ReleaseChannelStatus ¶
type ReleaseChannelStatuses ¶
type ReleaseChannelStatuses []*ReleaseChannelStatus
func (ReleaseChannelStatuses) Named ¶
func (r ReleaseChannelStatuses) Named(name string) *ReleaseChannelStatus
type Spec ¶
type Spec struct { Versions VersionsSpec `json:"versions,omitempty"` NodeSets NodeSetsSpec `json:"nodeSets,omitempty" yaml:"nodeSets"` }
type VersionRange ¶
type VersionRange struct { Min *semver.Version `json:"min,omitempty"` Max *semver.Version `json:"max,omitempty"` }
func (VersionRange) MergeRange ¶
func (v VersionRange) MergeRange(other VersionRange) VersionRange
func (VersionRange) MergeVersion ¶
func (v VersionRange) MergeVersion(other *semver.Version) VersionRange
func (VersionRange) Same ¶
func (v VersionRange) Same() bool
type VersionStatus ¶
type VersionStatus struct { Target *semver.Version `json:"target,omitempty"` Nodes VersionRange `json:"nodes"` Api VersionRange `json:"api"` Workers VersionRange `json:"workers"` Channels ReleaseChannelStatuses `json:"channels,omitempty"` }
func (VersionStatus) NewApiNodeVersion ¶
func (v VersionStatus) NewApiNodeVersion() *semver.Version
func (VersionStatus) NewNodeVersion ¶
func (v VersionStatus) NewNodeVersion(apiServer bool) *semver.Version
func (VersionStatus) NewWorkerNodeVersion ¶
func (v VersionStatus) NewWorkerNodeVersion() *semver.Version
func (*VersionStatus) UpdateReleaseChannels ¶
func (v *VersionStatus) UpdateReleaseChannels(releaseChannel string, actions Actions) error
type VersionsSpec ¶
type VersionsSpec struct { BaseImage string `json:"baseImage,omitempty" yaml:"baseImage"` Kubernetes string `json:"kubernetes,omitempty"` Hetzanetes string `json:"hetzanetes,omitempty"` }
func (*VersionsSpec) GetBaseImage ¶
func (v *VersionsSpec) GetBaseImage() string
func (VersionsSpec) GetHetzanetes ¶
func (v VersionsSpec) GetHetzanetes() string
func (VersionsSpec) GetKubernetes ¶
func (v VersionsSpec) GetKubernetes() string
Source Files
¶
Click to show internal directories.
Click to hide internal directories.