Documentation ¶
Index ¶
- func IsIPAddressMatchForIPBlock(ip string, ipBlock *v1.IPBlock) (bool, error)
- func IsIPInCIDR(ip string, cidr string) (bool, error)
- 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 PathToKubeConfig() string
- func QualifiedServiceAddress(ns string, service string) string
- func RunMatchersTests()
- type Kubernetes
- 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 *networkingv1.NetworkPolicy) (*networkingv1.NetworkPolicy, error)
- func (k *Kubernetes) CreateOrUpdateNamespace(ns *v1.Namespace) (*v1.Namespace, error)
- func (k *Kubernetes) CreateOrUpdateNetworkPolicy(ns string, netpol *networkingv1.NetworkPolicy) (*networkingv1.NetworkPolicy, error)
- func (k *Kubernetes) CreateOrUpdateService(svc *v1.Service) (*v1.Service, error)
- func (k *Kubernetes) CreatePod(pod *v1.Pod) (*v1.Pod, error)
- func (k *Kubernetes) CreatePodIfNotExists(pod *v1.Pod) (*v1.Pod, error)
- func (k *Kubernetes) CreateService(svc *v1.Service) (*v1.Service, error)
- func (k *Kubernetes) CreateServiceIfNotExists(svc *v1.Service) (*v1.Service, error)
- func (k *Kubernetes) DeleteAllNetworkPoliciesInNamespace(ns string) error
- func (k *Kubernetes) DeleteAllNetworkPoliciesInNamespaces(nss []string) error
- func (k *Kubernetes) ExecuteRemoteCommand(namespace string, pod string, container string, command []string) (string, string, error, error)
- func (k *Kubernetes) GetNetworkPoliciesInNamespaces(namespaces []string) ([]networkingv1.NetworkPolicy, error)
- func (k *Kubernetes) GetPod(namespace string, pod string) (*v1.Pod, error)
- func (k *Kubernetes) GetPodsInNamespaces(namespaces []string) ([]v1.Pod, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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 PathToKubeConfig ¶ added in v0.0.3
func PathToKubeConfig() string
func QualifiedServiceAddress ¶
func RunMatchersTests ¶
func RunMatchersTests()
Types ¶
type Kubernetes ¶
type Kubernetes struct { ClientSet *kubernetes.Clientset RestConfig *rest.Config }
func NewKubernetesForContext ¶ added in v0.0.3
func NewKubernetesForContext(context string) (*Kubernetes, error)
func NewKubernetesForDefaultContext ¶ added in v0.0.3
func NewKubernetesForDefaultContext() (*Kubernetes, error)
func (*Kubernetes) CreateDaemonSet ¶
func (*Kubernetes) CreateDaemonSetIfNotExists ¶
func (*Kubernetes) CreateNetworkPolicy ¶
func (k *Kubernetes) CreateNetworkPolicy(netpol *networkingv1.NetworkPolicy) (*networkingv1.NetworkPolicy, error)
func (*Kubernetes) CreateOrUpdateNamespace ¶
func (*Kubernetes) CreateOrUpdateNetworkPolicy ¶
func (k *Kubernetes) CreateOrUpdateNetworkPolicy(ns string, netpol *networkingv1.NetworkPolicy) (*networkingv1.NetworkPolicy, error)
func (*Kubernetes) CreateOrUpdateService ¶
func (*Kubernetes) CreatePodIfNotExists ¶
func (*Kubernetes) CreateService ¶
func (*Kubernetes) CreateServiceIfNotExists ¶
func (*Kubernetes) DeleteAllNetworkPoliciesInNamespace ¶
func (k *Kubernetes) DeleteAllNetworkPoliciesInNamespace(ns string) error
func (*Kubernetes) DeleteAllNetworkPoliciesInNamespaces ¶
func (k *Kubernetes) DeleteAllNetworkPoliciesInNamespaces(nss []string) error
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) GetNetworkPoliciesInNamespaces ¶ added in v0.0.3
func (k *Kubernetes) GetNetworkPoliciesInNamespaces(namespaces []string) ([]networkingv1.NetworkPolicy, error)
func (*Kubernetes) GetPodsInNamespaces ¶
func (k *Kubernetes) GetPodsInNamespaces(namespaces []string) ([]v1.Pod, error)
Click to show internal directories.
Click to hide internal directories.