kube

package
v0.0.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 20, 2021 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsIPAddressMatchForIPBlock

func IsIPAddressMatchForIPBlock(ip string, ipBlock *v1.IPBlock) (bool, error)

func IsIPInCIDR

func IsIPInCIDR(ip string, cidr string) (bool, error)

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

func IsNameMatch(objectName string, matcher string) bool

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 QualifiedServiceAddress(ns string, service string) string

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 (k *Kubernetes) CreateDaemonSet(namespace string, ds *appsv1.DaemonSet) (*appsv1.DaemonSet, error)

func (*Kubernetes) CreateDaemonSetIfNotExists

func (k *Kubernetes) CreateDaemonSetIfNotExists(namespace string, ds *appsv1.DaemonSet) (*appsv1.DaemonSet, error)

func (*Kubernetes) CreateNetworkPolicy

func (k *Kubernetes) CreateNetworkPolicy(netpol *networkingv1.NetworkPolicy) (*networkingv1.NetworkPolicy, error)

func (*Kubernetes) CreateOrUpdateNamespace

func (k *Kubernetes) CreateOrUpdateNamespace(ns *v1.Namespace) (*v1.Namespace, error)

func (*Kubernetes) CreateOrUpdateNetworkPolicy

func (k *Kubernetes) CreateOrUpdateNetworkPolicy(ns string, netpol *networkingv1.NetworkPolicy) (*networkingv1.NetworkPolicy, error)

func (*Kubernetes) CreateOrUpdateService

func (k *Kubernetes) CreateOrUpdateService(svc *v1.Service) (*v1.Service, error)

func (*Kubernetes) CreatePod

func (k *Kubernetes) CreatePod(pod *v1.Pod) (*v1.Pod, error)

func (*Kubernetes) CreatePodIfNotExists

func (k *Kubernetes) CreatePodIfNotExists(pod *v1.Pod) (*v1.Pod, error)

func (*Kubernetes) CreateService

func (k *Kubernetes) CreateService(svc *v1.Service) (*v1.Service, error)

func (*Kubernetes) CreateServiceIfNotExists

func (k *Kubernetes) CreateServiceIfNotExists(svc *v1.Service) (*v1.Service, error)

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) GetPod

func (k *Kubernetes) GetPod(namespace string, pod string) (*v1.Pod, error)

func (*Kubernetes) GetPodsInNamespaces

func (k *Kubernetes) GetPodsInNamespaces(namespaces []string) ([]v1.Pod, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL