Documentation
¶
Index ¶
- Variables
- func SetupHeartBeat(name, namespace string, updater func(string, string))
- func SetupPortForwardHeartBeat(port int) *time.Ticker
- func SetupTimeDifference() error
- type HeartBeatStatus
- type Kubernetes
- func (k *Kubernetes) ClusterCidr(namespace string) ([]string, []string)
- func (k *Kubernetes) CreateRectifierPod(name string) (*coreV1.Pod, error)
- func (k *Kubernetes) CreateRouterPod(name string, labels, annotations map[string]string, ports map[int]int) (*coreV1.Pod, error)
- func (k *Kubernetes) CreateService(metaAndSpec *SvcMetaAndSpec) (*coreV1.Service, error)
- func (k *Kubernetes) DecreaseDeploymentRef(name string, namespace string) (cleanup bool, err error)
- func (k *Kubernetes) DecreasePodRef(name string, namespace string) (bool, error)
- func (k *Kubernetes) ExecInPod(containerName, podName, namespace string, cmd ...string) (string, string, error)
- func (k *Kubernetes) GetAllDeploymentInNamespace(namespace string) (*appV1.DeploymentList, error)
- func (k *Kubernetes) GetAllIngressInNamespace(namespace string) (*extV1.IngressList, error)
- func (k *Kubernetes) GetAllNamespaces() (*coreV1.NamespaceList, error)
- func (k *Kubernetes) GetAllServiceInNamespace(namespace string) (*coreV1.ServiceList, error)
- func (k *Kubernetes) GetConfigMap(name, namespace string) (*coreV1.ConfigMap, error)
- func (k *Kubernetes) GetConfigMapsByLabel(labels map[string]string, namespace string) (pods *coreV1.ConfigMapList, err error)
- func (k *Kubernetes) GetDeployment(name string, namespace string) (*appV1.Deployment, error)
- func (k *Kubernetes) GetDeploymentsByLabel(labels map[string]string, namespace string) (pods *appV1.DeploymentList, err error)
- func (k *Kubernetes) GetKtResources(namespace string) ([]coreV1.Pod, []coreV1.ConfigMap, []appV1.Deployment, []coreV1.Service, error)
- func (k *Kubernetes) GetOrCreateShadow(name string, labels, annotations, envs map[string]string, exposePorts string, ...) (string, string, string, error)
- func (k *Kubernetes) GetPod(name string, namespace string) (*coreV1.Pod, error)
- func (k *Kubernetes) GetPodsByLabel(labels map[string]string, namespace string) (*coreV1.PodList, error)
- func (k *Kubernetes) GetService(name, namespace string) (*coreV1.Service, error)
- func (k *Kubernetes) GetServicesByLabel(labels map[string]string, namespace string) (svcs *coreV1.ServiceList, err error)
- func (k *Kubernetes) GetServicesBySelector(matchLabels map[string]string, namespace string) ([]coreV1.Service, error)
- func (k *Kubernetes) IncreaseDeploymentRef(name string, namespace string) error
- func (k *Kubernetes) IncreasePodRef(name string, namespace string) error
- func (k *Kubernetes) RemoveConfigMap(name, namespace string) (err error)
- func (k *Kubernetes) RemoveDeployment(name, namespace string) (err error)
- func (k *Kubernetes) RemovePod(name, namespace string) (err error)
- func (k *Kubernetes) RemoveService(name, namespace string) (err error)
- func (k *Kubernetes) ScaleTo(name, namespace string, replicas *int32) (err error)
- func (k *Kubernetes) UpdateConfigMapHeartBeat(name, namespace string)
- func (k *Kubernetes) UpdateDeployment(deployment *appV1.Deployment) (*appV1.Deployment, error)
- func (k *Kubernetes) UpdateDeploymentHeartBeat(name, namespace string)
- func (k *Kubernetes) UpdatePod(pod *coreV1.Pod) (*coreV1.Pod, error)
- func (k *Kubernetes) UpdatePodHeartBeat(name, namespace string)
- func (k *Kubernetes) UpdateService(svc *coreV1.Service) (*coreV1.Service, error)
- func (k *Kubernetes) UpdateServiceHeartBeat(name, namespace string)
- func (k *Kubernetes) WaitPodReady(name, namespace string, timeoutSec int) (*coreV1.Pod, error)
- func (k *Kubernetes) WaitPodTerminate(name, namespace string) (*coreV1.Pod, error)
- func (k *Kubernetes) WaitPodsReady(labels map[string]string, namespace string, timeoutSec int) ([]coreV1.Pod, error)
- func (k *Kubernetes) WatchPod(name, namespace string, fAdd, fDel, fMod func(*coreV1.Pod))
- func (k *Kubernetes) WatchService(name, namespace string, fAdd, fDel, fMod func(*coreV1.Service))
- type KubernetesInterface
- type PodMetaAndSpec
- type ResourceMeta
- type SSHkeyMeta
- type SvcMetaAndSpec
Constants ¶
This section is empty.
Variables ¶
var LastHeartBeatStatus = &HeartBeatStatus{ status: map[string]bool{}, }
LastHeartBeatStatus record last heart beat status to avoid verbose log
Functions ¶
func SetupHeartBeat ¶
SetupHeartBeat setup heartbeat watcher
func SetupPortForwardHeartBeat ¶
SetupPortForwardHeartBeat setup heartbeat watcher for port forward
func SetupTimeDifference ¶
func SetupTimeDifference() error
SetupTimeDifference get time difference between cluster and local
Types ¶
type HeartBeatStatus ¶
func (*HeartBeatStatus) Set ¶
func (h *HeartBeatStatus) Set(key string, value bool)
type Kubernetes ¶
type Kubernetes struct {
Clientset kubernetes.Interface
}
Kubernetes implements KubernetesInterface
func (*Kubernetes) ClusterCidr ¶
func (k *Kubernetes) ClusterCidr(namespace string) ([]string, []string)
ClusterCidr get cluster CIDR
func (*Kubernetes) CreateRectifierPod ¶
func (k *Kubernetes) CreateRectifierPod(name string) (*coreV1.Pod, error)
CreateRectifierPod create pod for rectify time difference
func (*Kubernetes) CreateRouterPod ¶
func (k *Kubernetes) CreateRouterPod(name string, labels, annotations map[string]string, ports map[int]int) (*coreV1.Pod, error)
CreateRouterPod create router pod
func (*Kubernetes) CreateService ¶
func (k *Kubernetes) CreateService(metaAndSpec *SvcMetaAndSpec) (*coreV1.Service, error)
CreateService create kubernetes service
func (*Kubernetes) DecreaseDeploymentRef ¶
func (k *Kubernetes) DecreaseDeploymentRef(name string, namespace string) (cleanup bool, err error)
DecreaseDeploymentRef decrease deployment ref count by 1
func (*Kubernetes) DecreasePodRef ¶
func (k *Kubernetes) DecreasePodRef(name string, namespace string) (bool, error)
DecreasePodRef decrease pod ref count by 1
func (*Kubernetes) GetAllDeploymentInNamespace ¶
func (k *Kubernetes) GetAllDeploymentInNamespace(namespace string) (*appV1.DeploymentList, error)
GetAllDeploymentInNamespace get all deployment in specified namespace
func (*Kubernetes) GetAllIngressInNamespace ¶
func (k *Kubernetes) GetAllIngressInNamespace(namespace string) (*extV1.IngressList, error)
GetAllIngressInNamespace get all ingresses in specified namespace
func (*Kubernetes) GetAllNamespaces ¶
func (k *Kubernetes) GetAllNamespaces() (*coreV1.NamespaceList, error)
GetAllNamespaces get all namespaces
func (*Kubernetes) GetAllServiceInNamespace ¶
func (k *Kubernetes) GetAllServiceInNamespace(namespace string) (*coreV1.ServiceList, error)
GetAllServiceInNamespace get all services in specified namespace
func (*Kubernetes) GetConfigMap ¶
func (k *Kubernetes) GetConfigMap(name, namespace string) (*coreV1.ConfigMap, error)
GetConfigMap get configmap
func (*Kubernetes) GetConfigMapsByLabel ¶
func (k *Kubernetes) GetConfigMapsByLabel(labels map[string]string, namespace string) (pods *coreV1.ConfigMapList, err error)
GetConfigMapsByLabel get deployments by label
func (*Kubernetes) GetDeployment ¶
func (k *Kubernetes) GetDeployment(name string, namespace string) (*appV1.Deployment, error)
GetDeployment ...
func (*Kubernetes) GetDeploymentsByLabel ¶
func (k *Kubernetes) GetDeploymentsByLabel(labels map[string]string, namespace string) (pods *appV1.DeploymentList, err error)
GetDeploymentsByLabel get deployments by label
func (*Kubernetes) GetKtResources ¶
func (k *Kubernetes) GetKtResources(namespace string) ([]coreV1.Pod, []coreV1.ConfigMap, []appV1.Deployment, []coreV1.Service, error)
GetKtResources fetch all kt pods and deployments
func (*Kubernetes) GetOrCreateShadow ¶
func (k *Kubernetes) GetOrCreateShadow(name string, labels, annotations, envs map[string]string, exposePorts string, portNameDict map[int]string) ( string, string, string, error)
GetOrCreateShadow create shadow pod or deployment
func (*Kubernetes) GetPodsByLabel ¶
func (k *Kubernetes) GetPodsByLabel(labels map[string]string, namespace string) (*coreV1.PodList, error)
GetPodsByLabel get pods by label
func (*Kubernetes) GetService ¶
func (k *Kubernetes) GetService(name, namespace string) (*coreV1.Service, error)
GetService get service
func (*Kubernetes) GetServicesByLabel ¶
func (k *Kubernetes) GetServicesByLabel(labels map[string]string, namespace string) (svcs *coreV1.ServiceList, err error)
GetServicesByLabel get services by label
func (*Kubernetes) GetServicesBySelector ¶
func (k *Kubernetes) GetServicesBySelector(matchLabels map[string]string, namespace string) ([]coreV1.Service, error)
GetServicesBySelector get services by selector
func (*Kubernetes) IncreaseDeploymentRef ¶
func (k *Kubernetes) IncreaseDeploymentRef(name string, namespace string) error
IncreaseDeploymentRef increase deployment ref count by 1
func (*Kubernetes) IncreasePodRef ¶
func (k *Kubernetes) IncreasePodRef(name string, namespace string) error
IncreasePodRef increase pod ref count by 1
func (*Kubernetes) RemoveConfigMap ¶
func (k *Kubernetes) RemoveConfigMap(name, namespace string) (err error)
RemoveConfigMap remove ConfigMap instance
func (*Kubernetes) RemoveDeployment ¶
func (k *Kubernetes) RemoveDeployment(name, namespace string) (err error)
RemoveDeployment remove deployment instances
func (*Kubernetes) RemovePod ¶
func (k *Kubernetes) RemovePod(name, namespace string) (err error)
RemovePod remove pod instances
func (*Kubernetes) RemoveService ¶
func (k *Kubernetes) RemoveService(name, namespace string) (err error)
RemoveService remove service
func (*Kubernetes) ScaleTo ¶
func (k *Kubernetes) ScaleTo(name, namespace string, replicas *int32) (err error)
ScaleTo scale deployment to
func (*Kubernetes) UpdateConfigMapHeartBeat ¶
func (k *Kubernetes) UpdateConfigMapHeartBeat(name, namespace string)
func (*Kubernetes) UpdateDeployment ¶
func (k *Kubernetes) UpdateDeployment(deployment *appV1.Deployment) (*appV1.Deployment, error)
UpdateDeployment ...
func (*Kubernetes) UpdateDeploymentHeartBeat ¶
func (k *Kubernetes) UpdateDeploymentHeartBeat(name, namespace string)
func (*Kubernetes) UpdatePodHeartBeat ¶
func (k *Kubernetes) UpdatePodHeartBeat(name, namespace string)
func (*Kubernetes) UpdateService ¶
UpdateService ...
func (*Kubernetes) UpdateServiceHeartBeat ¶
func (k *Kubernetes) UpdateServiceHeartBeat(name, namespace string)
func (*Kubernetes) WaitPodReady ¶
WaitPodReady ...
func (*Kubernetes) WaitPodTerminate ¶
func (k *Kubernetes) WaitPodTerminate(name, namespace string) (*coreV1.Pod, error)
WaitPodTerminate ...
func (*Kubernetes) WaitPodsReady ¶
func (*Kubernetes) WatchPod ¶
func (k *Kubernetes) WatchPod(name, namespace string, fAdd, fDel, fMod func(*coreV1.Pod))
WatchPod ...
func (*Kubernetes) WatchService ¶
func (k *Kubernetes) WatchService(name, namespace string, fAdd, fDel, fMod func(*coreV1.Service))
WatchService ...
type KubernetesInterface ¶
type KubernetesInterface interface {
GetPod(name string, namespace string) (*coreV1.Pod, error)
GetPodsByLabel(labels map[string]string, namespace string) (*coreV1.PodList, error)
UpdatePod(pod *coreV1.Pod) (*coreV1.Pod, error)
RemovePod(name, namespace string) error
GetOrCreateShadow(name string, labels, annotations, envs map[string]string, portsToExpose string, portNameDict map[int]string) (string, string, string, error)
CreateRouterPod(name string, labels, annotations map[string]string, ports map[int]int) (*coreV1.Pod, error)
CreateRectifierPod(name string) (*coreV1.Pod, error)
UpdatePodHeartBeat(name, namespace string)
WaitPodReady(name, namespace string, timeoutSec int) (*coreV1.Pod, error)
WaitPodTerminate(name, namespace string) (*coreV1.Pod, error)
WatchPod(name, namespace string, fAdd, fDel, fMod func(*coreV1.Pod))
ExecInPod(containerName, podName, namespace string, cmd ...string) (string, string, error)
IncreasePodRef(name, namespace string) error
DecreasePodRef(name, namespace string) (bool, error)
GetDeployment(name string, namespace string) (*appV1.Deployment, error)
GetDeploymentsByLabel(labels map[string]string, namespace string) (*appV1.DeploymentList, error)
GetAllDeploymentInNamespace(namespace string) (*appV1.DeploymentList, error)
UpdateDeployment(deployment *appV1.Deployment) (*appV1.Deployment, error)
RemoveDeployment(name, namespace string) error
IncreaseDeploymentRef(name, namespace string) error
DecreaseDeploymentRef(name, namespace string) (bool, error)
ScaleTo(deployment, namespace string, replicas *int32) (err error)
GetService(name, namespace string) (*coreV1.Service, error)
GetServicesBySelector(matchLabels map[string]string, namespace string) ([]coreV1.Service, error)
GetAllServiceInNamespace(namespace string) (*coreV1.ServiceList, error)
GetServicesByLabel(labels map[string]string, namespace string) (*coreV1.ServiceList, error)
CreateService(metaAndSpec *SvcMetaAndSpec) (*coreV1.Service, error)
UpdateService(svc *coreV1.Service) (*coreV1.Service, error)
RemoveService(name, namespace string) (err error)
UpdateServiceHeartBeat(name, namespace string)
WatchService(name, namespace string, fAdd, fDel, fMod func(*coreV1.Service))
GetConfigMap(name, namespace string) (*coreV1.ConfigMap, error)
GetConfigMapsByLabel(labels map[string]string, namespace string) (*coreV1.ConfigMapList, error)
RemoveConfigMap(name, namespace string) (err error)
UpdateConfigMapHeartBeat(name, namespace string)
GetAllIngressInNamespace(namespace string) (*extV1.IngressList, error)
GetKtResources(namespace string) ([]coreV1.Pod, []coreV1.ConfigMap, []appV1.Deployment, []coreV1.Service, error)
GetAllNamespaces() (*coreV1.NamespaceList, error)
ClusterCidr(namespace string) (cidr []string, excludeCidr []string)
}
KubernetesInterface kubernetes interface
type PodMetaAndSpec ¶
type PodMetaAndSpec struct {
Meta *ResourceMeta
Image string
Envs map[string]string
Ports map[string]int
IsLeaf bool
}
PodMetaAndSpec ...
type ResourceMeta ¶
type ResourceMeta struct {
Name string
Namespace string
Labels map[string]string
Annotations map[string]string
}
ResourceMeta ...
type SSHkeyMeta ¶
SSHkeyMeta ...
type SvcMetaAndSpec ¶
type SvcMetaAndSpec struct {
Meta *ResourceMeta
External bool
Ports map[int]int
Selectors map[string]string
}
SvcMetaAndSpec ...