Documentation
¶
Index ¶
- func Clientset() (*kubernetes.Clientset, error)
- func IsIPBlockMatchForIP(ip string, ipBlock *v1.IPBlock) bool
- func IsIPInCIDR(ip string, cidr string) bool
- func IsLabelsMatchLabelSelector(labels map[string]string, labelSelector metav1.LabelSelector) bool
- func IsMatchExpressionMatchForLabels(labels map[string]string, exp metav1.LabelSelectorRequirement) bool
- func IsNameMatch(objectName string, matcher string) bool
- func QualifiedServiceAddress(ns string, service string) string
- type CurlCommand
- type KindClient
- func (kc *KindClient) CreateCluster(clusterName string, image string, config string) error
- func (kc *KindClient) CreateClusterWithConfigFile(clusterName string, image string, configFilePath string) error
- func (kc *KindClient) GetCluster(name string) (bool, error)
- func (kc *KindClient) GetClusters() ([]string, error)
- func (kc *KindClient) GetVersion() (string, error)
- type Kubernetes
- func (k *Kubernetes) CleanNetworkPolicies(ns string) error
- func (k *Kubernetes) CreateDaemonSet(namespace string, ds *appsv1.DaemonSet) (*appsv1.DaemonSet, error)
- func (k *Kubernetes) CreateDaemonSetIfNotExists(namespace string, ds *appsv1.DaemonSet) (*appsv1.DaemonSet, error)
- func (k *Kubernetes) CreateNetworkPolicy(netpol *v1net.NetworkPolicy) (*v1net.NetworkPolicy, error)
- func (k *Kubernetes) CreateOrUpdateNamespace(n string, labels map[string]string) (*v1.Namespace, error)
- func (k *Kubernetes) CreateOrUpdateNetworkPolicy(ns string, netpol *v1net.NetworkPolicy) (*v1net.NetworkPolicy, error)
- func (k *Kubernetes) CreateService(namespace string, svc *v1.Service) (*v1.Service, error)
- func (k *Kubernetes) CreateServiceIfNotExists(namespace string, svc *v1.Service) (*v1.Service, error)
- func (k *Kubernetes) ExecuteRemoteCommand(namespace string, pod string, container string, command []string) (string, string, error, error)
- func (k *Kubernetes) GetPodsInNamespaces(namespaces []string) ([]v1.Pod, error)
- func (k *Kubernetes) Probe(job *ProbeJob) (*ProbeResult, error)
- func (k *Kubernetes) ProbeConnectivity(jobs []*ProbeJob) *netpol.StringTruthTable
- func (k *Kubernetes) ProbePodToPod(namespaces []string, timeoutSeconds int) (*netpol.StringTruthTable, error)
- type NetcatCommand
- type ProbeCommand
- type ProbeCommandType
- type ProbeJob
- type ProbeJobResult
- type ProbeResult
- type WgetCommand
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Clientset ¶
func Clientset() (*kubernetes.Clientset, error)
func IsIPBlockMatchForIP ¶
IsIPBlockMatchForIP is completely untested. TODO!
func IsIPInCIDR ¶
func IsLabelsMatchLabelSelector ¶
func IsLabelsMatchLabelSelector(labels map[string]string, labelSelector metav1.LabelSelector) bool
IsLabelsMatchLabelSelector matches labels to a kube LabelSelector. From the docs: > A label selector is a label query over a set of resources. The result of matchLabels and > matchExpressions are ANDed. An empty label selector matches all objects. A null > label selector matches no objects.
func IsMatchExpressionMatchForLabels ¶
func IsMatchExpressionMatchForLabels(labels map[string]string, exp metav1.LabelSelectorRequirement) bool
func IsNameMatch ¶
IsNameMatch follows the kube pattern of "empty string means matches All" It will return:
if matcher is empty: true if objectName and matcher are the same: true otherwise false
func QualifiedServiceAddress ¶
Types ¶
type CurlCommand ¶
func (*CurlCommand) Command ¶
func (cc *CurlCommand) Command() []string
func (*CurlCommand) ParseOutput ¶
func (cc *CurlCommand) ParseOutput(out string, errorOut string, execErr error) *ProbeResult
type KindClient ¶
type KindClient struct{}
func NewKindClient ¶
func NewKindClient() *KindClient
func (*KindClient) CreateCluster ¶
func (kc *KindClient) CreateCluster(clusterName string, image string, config string) error
func (*KindClient) CreateClusterWithConfigFile ¶
func (kc *KindClient) CreateClusterWithConfigFile(clusterName string, image string, configFilePath string) error
func (*KindClient) GetCluster ¶
func (kc *KindClient) GetCluster(name string) (bool, error)
func (*KindClient) GetClusters ¶
func (kc *KindClient) GetClusters() ([]string, error)
func (*KindClient) GetVersion ¶
func (kc *KindClient) GetVersion() (string, error)
type Kubernetes ¶
type Kubernetes struct { ClientSet *kubernetes.Clientset // contains filtered or unexported fields }
func NewKubernetes ¶
func NewKubernetes() (*Kubernetes, error)
func (*Kubernetes) CleanNetworkPolicies ¶
func (k *Kubernetes) CleanNetworkPolicies(ns string) error
func (*Kubernetes) CreateDaemonSet ¶
func (*Kubernetes) CreateDaemonSetIfNotExists ¶
func (*Kubernetes) CreateNetworkPolicy ¶
func (k *Kubernetes) CreateNetworkPolicy(netpol *v1net.NetworkPolicy) (*v1net.NetworkPolicy, error)
func (*Kubernetes) CreateOrUpdateNamespace ¶
func (*Kubernetes) CreateOrUpdateNetworkPolicy ¶
func (k *Kubernetes) CreateOrUpdateNetworkPolicy(ns string, netpol *v1net.NetworkPolicy) (*v1net.NetworkPolicy, error)
func (*Kubernetes) CreateService ¶
func (*Kubernetes) CreateServiceIfNotExists ¶
func (*Kubernetes) ExecuteRemoteCommand ¶
func (k *Kubernetes) ExecuteRemoteCommand(namespace string, pod string, container string, command []string) (string, string, error, error)
ExecuteRemoteCommand executes a remote shell command on the given pod returns the output from stdout and stderr
func (*Kubernetes) GetPodsInNamespaces ¶
func (k *Kubernetes) GetPodsInNamespaces(namespaces []string) ([]v1.Pod, error)
func (*Kubernetes) Probe ¶
func (k *Kubernetes) Probe(job *ProbeJob) (*ProbeResult, error)
func (*Kubernetes) ProbeConnectivity ¶
func (k *Kubernetes) ProbeConnectivity(jobs []*ProbeJob) *netpol.StringTruthTable
func (*Kubernetes) ProbePodToPod ¶
func (k *Kubernetes) ProbePodToPod(namespaces []string, timeoutSeconds int) (*netpol.StringTruthTable, error)
type NetcatCommand ¶
func (*NetcatCommand) Command ¶
func (nc *NetcatCommand) Command() []string
func (*NetcatCommand) ParseOutput ¶
func (nc *NetcatCommand) ParseOutput(out string, errorOut string, execErr error) *ProbeResult
type ProbeCommand ¶
type ProbeCommand interface { Command() []string ParseOutput(out string, errorOut string, execErr error) *ProbeResult }
type ProbeCommandType ¶
type ProbeCommandType string
const ( ProbeCommandTypeCurl ProbeCommandType = "ProbeCommandTypeCurl" ProbeCommandTypeWget ProbeCommandType = "ProbeCommandTypeWget" ProbeCommandTypeNetcat ProbeCommandType = "ProbeCommandTypeNetcat" )
type ProbeJob ¶
type ProbeJob struct { FromNamespace string FromPod string FromContainer string ToAddress string ToPort int TimeoutSeconds int CommandType ProbeCommandType FromKey string ToKey string }
func (*ProbeJob) Command ¶
func (pj *ProbeJob) Command() ProbeCommand
func (*ProbeJob) GetFromKey ¶
func (*ProbeJob) KubeExecCommand ¶
type ProbeJobResult ¶
type ProbeJobResult struct { Job *ProbeJob Result *ProbeResult Err error }
ProbeJobResult : if command can't be run, Result should be nil and Err non-nil
type WgetCommand ¶
func (*WgetCommand) Command ¶
func (wc *WgetCommand) Command() []string
func (*WgetCommand) ParseOutput ¶
func (wc *WgetCommand) ParseOutput(out string, errorOut string, execErr error) *ProbeResult
Source Files
¶
Click to show internal directories.
Click to hide internal directories.