Documentation
¶
Index ¶
- Constants
- Variables
- func ExecCmd(command string) error
- func GetLocalK8sDeps() (*kubernetes.Clientset, *rest.Config, error)
- type ConnectionInfo
- type ConnectionMode
- type Forwarder
- type K8sClient
- func (m *K8sClient) Apply(manifest string) error
- func (m *K8sClient) CheckReady(c ManifestOutput) error
- func (m *K8sClient) CopyToPod(namespace, src, destination, containername string) (*bytes.Buffer, *bytes.Buffer, *bytes.Buffer, error)
- func (m *K8sClient) Create(manifest string) error
- func (m *K8sClient) DryRun(manifest string) error
- func (m *K8sClient) ListNamespaces(selector string) (*v1.NamespaceList, error)
- func (m *K8sClient) ListPods(namespace, selector string) (*v1.PodList, error)
- func (m *K8sClient) NamespaceExists(namespace string) bool
- func (m *K8sClient) RemoveNamespace(namespace string) error
- func (m *K8sClient) WaitForPodBySelectorRunning(c ManifestOutput) error
- func (m *K8sClient) WaitLogMessages(c ManifestOutput) error
- type ManifestOutput
- type Protocol
- type ReadyCheckData
- type URLConverter
Constants ¶
const ( TempDebugManifest = "tmp-manifest.yaml" LogPollInterval = 2 * time.Second )
Variables ¶
var ( ProjectRoot = filepath.Join(filepath.Dir(b), "../") DistRoot = filepath.Join(ProjectRoot, "dist") DiffsDir = filepath.Join(ProjectRoot, "diffs") )
Functions ¶
func GetLocalK8sDeps ¶
func GetLocalK8sDeps() (*kubernetes.Clientset, *rest.Config, error)
GetLocalK8sDeps get local k8s context config
Types ¶
type ConnectionInfo ¶
type ConnectionInfo struct {
Ports portforward.ForwardedPort
Host string
}
type ConnectionMode ¶
type ConnectionMode int
const ( LocalConnection ConnectionMode = iota RemoteConnection )
type Forwarder ¶
type Forwarder struct {
Client *K8sClient
KeepConnection bool
Info map[string]interface{}
// contains filtered or unexported fields
}
func NewForwarder ¶
func (*Forwarder) FindPort ¶
func (m *Forwarder) FindPort(ks ...string) *URLConverter
type K8sClient ¶
type K8sClient struct {
ClientSet *kubernetes.Clientset
RESTConfig *rest.Config
}
K8sClient high level k8s client
func NewK8sClient ¶
func NewK8sClient() *K8sClient
NewK8sClient creates a new k8s client with a REST config
func (*K8sClient) CheckReady ¶
func (m *K8sClient) CheckReady(c ManifestOutput) error
CheckReady application heath check using ManifestOutputData params
func (*K8sClient) CopyToPod ¶
func (m *K8sClient) CopyToPod(namespace, src, destination, containername string) (*bytes.Buffer, *bytes.Buffer, *bytes.Buffer, error)
CopyToPod copies src to a particular container. Destination should be in the form of a proper K8s destination path NAMESPACE/POD_NAME:folder/FILE_NAME
func (*K8sClient) ListNamespaces ¶
func (m *K8sClient) ListNamespaces(selector string) (*v1.NamespaceList, error)
func (*K8sClient) NamespaceExists ¶
NamespaceExists check if namespace exists
func (*K8sClient) RemoveNamespace ¶
RemoveNamespace removes namespace
func (*K8sClient) WaitForPodBySelectorRunning ¶
func (m *K8sClient) WaitForPodBySelectorRunning(c ManifestOutput) error
WaitForPodBySelectorRunning Wait up to timeout seconds for all pods in 'namespace' with given 'selector' to enter running state. Returns an error if no pods are found or not all discovered pods enter running state.
func (*K8sClient) WaitLogMessages ¶
func (m *K8sClient) WaitLogMessages(c ManifestOutput) error
WaitLogMessages waits for log messages substrings
type ManifestOutput ¶
type ManifestOutput interface {
SetNamespace(ns string)
GetNamespace() string
GetReadyCheckData() ReadyCheckData
ProcessConnections(fwd *Forwarder) (map[string][]string, error)
}
ManifestOutput and interface to interact with a deployed environment
type Protocol ¶
type Protocol int
Protocol represents a URL scheme to use when fetching connection details
type ReadyCheckData ¶
type URLConverter ¶
type URLConverter struct {
// contains filtered or unexported fields
}
URLConverter converts ports to URLs
func NewURLConverter ¶
func NewURLConverter(fp ConnectionInfo, err error) *URLConverter
NewURLConverter creates new URLConverter instance
func (*URLConverter) As ¶
func (m *URLConverter) As(conn ConnectionMode, proto Protocol) (string, error)
As converts host/port to an URL