Documentation ¶
Index ¶
- func IsIPAddressMatchForIPBlock(ip string, ipBlock *networkingv1.IPBlock) (bool, error)
- func IsIPInCIDR(ip string, cidr string) (bool, error)
- func IsLabelSelectorEmpty(l metav1.LabelSelector) 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 LabelSelectorTableLines(selector metav1.LabelSelector) string
- func ParseProtocol(protocol string) (v1.Protocol, error)
- func QualifiedServiceAddress(serviceName string, namespace string) string
- func RunIPAddressTests()
- func SerializeLabelSelector(ls metav1.LabelSelector) string
- type Kubernetes
- func (k *Kubernetes) CreateNetworkPolicy(policy *networkingv1.NetworkPolicy) (*networkingv1.NetworkPolicy, error)
- func (k *Kubernetes) CreateOrUpdateNamespace(ns *v1.Namespace) (*v1.Namespace, 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) DeleteNamespace(ns string) error
- func (k *Kubernetes) DeleteNetworkPolicy(ns string, name string) error
- func (k *Kubernetes) ExecuteRemoteCommand(namespace string, pod string, container string, command []string) (string, string, error, error)
- func (k *Kubernetes) GetNamespace(namespace string) (*v1.Namespace, error)
- func (k *Kubernetes) GetNetworkPoliciesInNamespaces(namespaces []string) ([]networkingv1.NetworkPolicy, error)
- func (k *Kubernetes) GetPod(namespace string, podName string) (*v1.Pod, error)
- func (k *Kubernetes) GetPodsInNamespaces(namespaces []string) ([]v1.Pod, error)
- func (k *Kubernetes) GetService(namespace string, name string) (*v1.Service, error)
- func (k *Kubernetes) SetNamespaceLabels(namespace string, labels map[string]string) (*v1.Namespace, error)
- func (k *Kubernetes) SetPodLabels(namespace string, podName string, labels map[string]string) (*v1.Pod, error)
- func (k *Kubernetes) UpdateNetworkPolicy(policy *networkingv1.NetworkPolicy) (*networkingv1.NetworkPolicy, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsIPAddressMatchForIPBlock ¶
func IsIPAddressMatchForIPBlock(ip string, ipBlock *networkingv1.IPBlock) (bool, error)
func IsLabelSelectorEmpty ¶ added in v0.0.8
func IsLabelSelectorEmpty(l metav1.LabelSelector) bool
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 LabelSelectorTableLines ¶ added in v0.2.0
func LabelSelectorTableLines(selector metav1.LabelSelector) string
func QualifiedServiceAddress ¶
QualifiedServiceAddress returns the address that can be used to hit a service from any namespace in the cluster
func QualifiedServiceAddress(serviceName string, namespace string, dnsDomain string) string { return fmt.Sprintf("%s.%s.svc.%s", serviceName, namespace, dnsDomain)
func RunIPAddressTests ¶ added in v0.0.8
func RunIPAddressTests()
func SerializeLabelSelector ¶ added in v0.0.8
func SerializeLabelSelector(ls metav1.LabelSelector) string
SerializeLabelSelector deterministically converts a metav1.LabelSelector into a string
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 (*Kubernetes) CreateNetworkPolicy ¶
func (k *Kubernetes) CreateNetworkPolicy(policy *networkingv1.NetworkPolicy) (*networkingv1.NetworkPolicy, error)
func (*Kubernetes) CreateOrUpdateNamespace ¶
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) DeleteNamespace ¶ added in v0.1.1
func (k *Kubernetes) DeleteNamespace(ns string) error
func (*Kubernetes) DeleteNetworkPolicy ¶ added in v0.1.0
func (k *Kubernetes) DeleteNetworkPolicy(ns string, name 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) GetNamespace ¶ added in v0.1.0
func (k *Kubernetes) GetNamespace(namespace string) (*v1.Namespace, error)
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)
func (*Kubernetes) GetService ¶ added in v0.1.0
func (*Kubernetes) SetNamespaceLabels ¶ added in v0.1.0
func (*Kubernetes) SetPodLabels ¶ added in v0.1.0
func (*Kubernetes) UpdateNetworkPolicy ¶ added in v0.1.0
func (k *Kubernetes) UpdateNetworkPolicy(policy *networkingv1.NetworkPolicy) (*networkingv1.NetworkPolicy, error)