Documentation ¶
Index ¶
- Constants
- func ExecCmd(command string) error
- func GetLocalK8sDeps() (*kubernetes.Clientset, *rest.Config, error)
- type Chaos
- type ChaosState
- type ConnectionInfo
- type ConnectionMode
- type Forwarder
- type K8sClient
- func (m *K8sClient) AddLabel(namespace string, selector string, label string) error
- func (m *K8sClient) AddLabelByPod(namespace string, pod v1.Pod, key, value string) error
- func (m *K8sClient) Apply(manifest string) error
- func (m *K8sClient) CheckReady(namespace string, c *ReadyCheckData) 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) DeleteResource(namespace string, resource string, instance string) error
- func (m *K8sClient) DryRun(manifest string) error
- func (m *K8sClient) EnumerateInstances(namespace string, selector string) error
- func (m *K8sClient) ExecuteInPod(namespace, podName, containerName string, command []string) ([]byte, []byte, error)
- func (m *K8sClient) LabelChaosGroup(namespace string, startInstance int, endInstance int, group string) error
- func (m *K8sClient) LabelChaosGroupByLabels(namespace string, labels map[string]string, group 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) UniqueLabels(namespace string, selector string) ([]string, error)
- func (m *K8sClient) WaitContainersReady(ns string, rcd *ReadyCheckData) error
- func (m *K8sClient) WaitForPodBySelectorRunning(ns string, rcd *ReadyCheckData) error
- type Protocol
- type ReadyCheckData
- type URLConverter
Constants ¶
const ( TempDebugManifest = "tmp-manifest-%s.yaml" ContainerStatePollInterval = 3 * time.Second AppLabel = "app" )
Variables ¶
This section is empty.
Functions ¶
func GetLocalK8sDeps ¶
func GetLocalK8sDeps() (*kubernetes.Clientset, *rest.Config, error)
GetLocalK8sDeps get local k8s context config
Types ¶
type Chaos ¶ added in v0.2.4
Chaos is controller that manages Chaosmesh CRD instances to run experiments
func (*Chaos) WaitForAllRecovered ¶ added in v0.2.44
type ChaosState ¶ added in v0.2.44
type ChaosState struct {
ChaosDetails v1alpha1.ChaosStatus `json:"status"`
}
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) AddLabel ¶ added in v0.2.2
AddLabel adds a new label to a group of pods defined by selector
func (*K8sClient) AddLabelByPod ¶ added in v0.2.14
AddLabelByPod adds a label to a pod
func (*K8sClient) CheckReady ¶
func (m *K8sClient) CheckReady(namespace string, c *ReadyCheckData) 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) DeleteResource ¶ added in v0.2.4
DeleteResource deletes resource
func (*K8sClient) EnumerateInstances ¶ added in v0.2.2
EnumerateInstances enumerate pods with instance label
func (*K8sClient) ExecuteInPod ¶ added in v0.2.3
func (m *K8sClient) ExecuteInPod(namespace, podName, containerName string, command []string) ([]byte, []byte, error)
ExecuteInPod is similar to kubectl exec
func (*K8sClient) LabelChaosGroup ¶ added in v0.2.14
func (*K8sClient) LabelChaosGroupByLabels ¶ added in v0.2.44
func (*K8sClient) ListNamespaces ¶
func (m *K8sClient) ListNamespaces(selector string) (*v1.NamespaceList, error)
ListNamespaces lists k8s namespaces
func (*K8sClient) NamespaceExists ¶
NamespaceExists check if namespace exists
func (*K8sClient) RemoveNamespace ¶
RemoveNamespace removes namespace
func (*K8sClient) UniqueLabels ¶ added in v0.2.2
UniqueLabels gets all unique application labels
func (*K8sClient) WaitContainersReady ¶ added in v0.2.1
func (m *K8sClient) WaitContainersReady(ns string, rcd *ReadyCheckData) error
WaitContainersReady waits until all containers ReadinessChecks are passed
func (*K8sClient) WaitForPodBySelectorRunning ¶
func (m *K8sClient) WaitForPodBySelectorRunning(ns string, rcd *ReadyCheckData) 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.
type Protocol ¶
type Protocol int
Protocol represents a URL scheme to use when fetching connection details
type ReadyCheckData ¶
ReadyCheckData data to check if selected pods are running and all containers are ready ( readiness check ) are ready
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