hope

package
v0.14.1 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2020 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	JobStatusUnknown  JobStatus = 0
	JobStatusRunning            = 1
	JobStatusComplete           = 2
	JobStatusFailed             = 3
)

Variables

View Source
var DockerDaemonJson = `` /* 259-byte string literal not displayed */
View Source
var IpForward = `1
`
View Source
var K8SConf = `net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
`

Functions

func CopySSHKeyToAuthorizedKeys

func CopySSHKeyToAuthorizedKeys(log *logrus.Entry, keyPath string, node *Node) error

func CreateClusterMaster

func CreateClusterMaster(log *logrus.Entry, node *Node, podNetworkCidr string) error

func CreateClusterNode

func CreateClusterNode(log *logrus.Entry, node *Node, masterIp string) error

func DisableSelinuxOnRemote

func DisableSelinuxOnRemote(node *Node) error

func DisableSwapOnRemote

func DisableSwapOnRemote(node *Node) error

func EnsureSSHWithoutPassword

func EnsureSSHWithoutPassword(log *logrus.Entry, node *Node) error

func FetchKubeconfig

func FetchKubeconfig(log *logrus.Entry, node *Node, merge bool) error

func FollowLogsAndPollUntilJobComplete

func FollowLogsAndPollUntilJobComplete(log *logrus.Entry, kubectl *kubeutil.Kubectl, job string, maxAttempts int, failedPollDelayMaxSeconds int) error

func FollowLogsIfContainersRunning

func FollowLogsIfContainersRunning(kubectl *kubeutil.Kubectl, job string) error

func GetPodsForJob

func GetPodsForJob(kubectl *kubeutil.Kubectl, job string) (*[]string, error)

func KubeadmResetRemote

func KubeadmResetRemote(log *logrus.Entry, kubectl *kubeutil.Kubectl, node *Node, force bool) error

func KubectlApplyF

func KubectlApplyF(kubectl *kubeutil.Kubectl, path string) error

func KubectlApplyStdIn

func KubectlApplyStdIn(kubectl *kubeutil.Kubectl, stdin string) error

func KubectlCreateStdIn

func KubectlCreateStdIn(kubectl *kubeutil.Kubectl, stdin string) error

func KubectlDeleteF added in v0.10.0

func KubectlDeleteF(kubectl *kubeutil.Kubectl, path string) error

func KubectlDeleteStdIn added in v0.10.0

func KubectlDeleteStdIn(kubectl *kubeutil.Kubectl, stdin string) error

func KubectlGetCreateStdIn

func KubectlGetCreateStdIn(kubectl *kubeutil.Kubectl, stdin string) (string, error)

func SetHostname

func SetHostname(log *logrus.Entry, node *Node, hostname string, force bool) error

func TaintNodeByHost

func TaintNodeByHost(kubectl *kubeutil.Kubectl, node *Node, taint string) error

func TestCanSSHWithoutPassword

func TestCanSSHWithoutPassword(node *Node) error

Attempt to SSH into a machine without allowing password authentication. Also disables strict host checking to prevent the unattended nature of the

execution from causing the script to fail.

func TryConfigureSSH

func TryConfigureSSH(log *logrus.Entry, node *Node) error

See what SSH key this host is trying to use, and try copying it over to the

appropriate place using password auth.

Types

type BuildSpec added in v0.14.0

type BuildSpec struct {
	Path   string
	Source string
	Tag    string
	Pull   string
}

BuildSpec - Properties of a ResourceTypeDockerBuild

type ExecSpec added in v0.14.0

type ExecSpec struct {
	Selector string
	Timeout  string
	Command  []string
}

ExecSpec - Properties of a ResourceTypeExec

type Job added in v0.14.0

type Job struct {
	Name       string
	File       string
	Parameters []string
}

Job - Properties that can appear in any ephemeral job definition. TODO: Allow jobs to define max retry parameters, or accept them on the

command line.

type JobStatus

type JobStatus int

func GetJobStatus

func GetJobStatus(log *logrus.Entry, kubectl *kubeutil.Kubectl, job string) (JobStatus, error)

Check to see if the provided job has completed, or is still running.

type Node added in v0.14.0

type Node struct {
	Name string
	Role string
	Host string
	User string
}

Node - Defines a networked resource on which operations will typically be

executed.

func (*Node) ConnectionString added in v0.14.0

func (node *Node) ConnectionString() string

ConnectionString - Get the node's connection string

func (*Node) IsMaster added in v0.14.0

func (node *Node) IsMaster() bool

IsMaster - Whether or not this node is a control plane node.

func (*Node) IsMasterAndNode added in v0.14.0

func (node *Node) IsMasterAndNode() bool

IsMasterAndNode - Whether or not this node plays the roles of both control

plane and worker node.

func (*Node) IsNode added in v0.14.0

func (node *Node) IsNode() bool

IsNode - Whether or not this node is a worker node.

func (*Node) IsRoleValid added in v0.14.0

func (node *Node) IsRoleValid() bool

IsRoleValid - Whether or not the node has a role that has been implemented.

type Resource added in v0.14.0

type Resource struct {
	Name       string
	File       string
	Inline     string
	Parameters []string
	Build      BuildSpec
	Job        string
	Exec       ExecSpec
	Tags       []string
}

Resource - Properties that can appear in any resources. There may be a better way of doing this, but with a pretty generic list of

items appearing in a yaml file, maybe not.

func (*Resource) GetType added in v0.14.0

func (resource *Resource) GetType() (ResourceType, error)

GetType - Scan through defined properties, and return the resource type

that the resource appears to implement.

type ResourceType added in v0.14.0

type ResourceType int

ResourceType enum to differentiate the types of resource definitions that

can appear in the hope yaml file.
const (
	// ResourceTypeUnknown - No resource type could be determined for the
	//   resource being evaluated.
	ResourceTypeUnknown ResourceType = iota

	// ResourceTypeFile - Provide a path to a local file/URL to a remote file
	//    to apply.
	ResourceTypeFile

	// ResourceTypeInline - Provide an inline yaml definition of resources to
	//   apply.
	ResourceTypeInline

	// ResourceTypeDockerBuild - Build a docker image with the given context
	//   path, and push it to the specified repository.
	ResourceTypeDockerBuild

	// ResourceTypeJob - Wait for a job with the given name to finish
	//   executing.
	ResourceTypeJob

	// ResourceTypeExec - Execute a script in a running pod/container.
	ResourceTypeExec
)

func (ResourceType) String added in v0.14.0

func (rt ResourceType) String() string

type TextSubstitutor

type TextSubstitutor struct {
	Bytes *[]byte
}

func NewTextSubstitutorFromBytes

func NewTextSubstitutorFromBytes(bytes []byte) *TextSubstitutor

func NewTextSubstitutorFromString

func NewTextSubstitutorFromString(str string) *TextSubstitutor

func TextSubstitutorFromFilepath

func TextSubstitutorFromFilepath(filepath string) (*TextSubstitutor, error)

func (*TextSubstitutor) SubstituteTextFromEnv

func (t *TextSubstitutor) SubstituteTextFromEnv(envVarsNames []string) error

func (*TextSubstitutor) SubstituteTextFromMap

func (t *TextSubstitutor) SubstituteTextFromMap(variables map[string]string) error

Jump to

Keyboard shortcuts

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