Documentation ¶
Index ¶
- Constants
- Variables
- func Clone(src, dst interface{}) error
- func CreateID() int
- func DeepCopy(src, dst interface{}) error
- func DeepCopyObj(src, dst interface{}) error
- func DeleteID(id int)
- func GetOwnerData(ctx context.Context, name string, kind string, apiVersion string, ...) interface{}
- func HashByteArray(text []byte) []byte
- func IDCreator() int
- func IsPodExist(pod *core.Pod, pdm map[int]*list.List) bool
- func NewJsonFormat() jsonFormat
- func RemoveNode(node *core.Node, ndm map[int]*list.List) string
- func WaitTillNewDataArrived(wh *WatchHandler) bool
- type CRDOwnerData
- type DataSocket
- type EventObjectData
- type EventProcessor
- type IDDataBase
- type JsonType
- type MicroServiceData
- type NodeData
- type ObjectData
- type OwnerDet
- type OwnerDetNameAndKindOnly
- type PodDataForExistMicroService
- type ReqType
- type ScanNewImageData
- type StateType
- type WatchHandler
- func (wh *WatchHandler) Cancel()
- func (wh *WatchHandler) CheckInstanceMetadataAPIVendor() string
- func (wh *WatchHandler) ClusterVersion() *version.Info
- func (wh *WatchHandler) CronJobWatch(ctx context.Context)
- func (wh *WatchHandler) DeletePod(ctx context.Context, pod *core.Pod, podName string)
- func (wh *WatchHandler) ListenAndProcess(ctx context.Context, processor EventProcessor)
- func (wh *WatchHandler) NamespaceEventHandler(ctx context.Context, event *watch.Event, lastWatchEventCreationTime time.Time) error
- func (wh *WatchHandler) NamespaceWatch(ctx context.Context)
- func (wh *WatchHandler) NodeWatch(ctx context.Context)
- func (wh *WatchHandler) PodWatch(ctx context.Context)
- func (wh *WatchHandler) RemoveNamespace(namespace *corev1.Namespace) string
- func (wh *WatchHandler) RemovePod(pod *core.Pod, pdm map[int]*list.List) (int, bool, OwnerDet)
- func (wh *WatchHandler) Reset()
- func (wh *WatchHandler) RetrieveClusterInfo()
- func (wh *WatchHandler) SecretWatch(ctx context.Context)
- func (wh *WatchHandler) SendMessageToWebSocket(jsonData []byte)
- func (wh *WatchHandler) ServiceWatch(ctx context.Context)
- func (wh *WatchHandler) SetFirstReportFlag(first bool)
- func (wh *WatchHandler) UpdateNamespace(namespace *corev1.Namespace)
- type WebSocketHandler
- type WebSocketProcessor
Constants ¶
const (
WaitBeforeReportEnv = "WAIT_BEFORE_REPORT"
)
Variables ¶
var ( FirstReportEmptyBytes = []byte("{\"firstReport\":true}") FirstReportEmptyLength = len(FirstReportEmptyBytes) )
Functions ¶
func DeepCopyObj ¶
func DeepCopyObj(src, dst interface{}) error
DeepCopyObj uses "encoding/json" package
func GetOwnerData ¶
func GetOwnerData(ctx context.Context, name string, kind string, apiVersion string, namespace string, wh *WatchHandler) interface{}
GetOwnerData - get the data of pod owner
func HashByteArray ¶
func NewJsonFormat ¶ added in v0.1.26
func NewJsonFormat() jsonFormat
func WaitTillNewDataArrived ¶
func WaitTillNewDataArrived(wh *WatchHandler) bool
WaitTillNewDataArrived -
Types ¶
type CRDOwnerData ¶
type DataSocket ¶
type DataSocket struct { RType ReqType // contains filtered or unexported fields }
type EventObjectData ¶ added in v0.1.26
func NewEventObjectData ¶ added in v0.1.26
func NewEventObjectData() EventObjectData
func (*EventObjectData) MarshalJSON ¶ added in v0.1.26
func (e *EventObjectData) MarshalJSON() ([]byte, error)
type EventProcessor ¶
type EventProcessor interface {
ProcessEventData(data []byte)
}
EventProcessor to process data
type IDDataBase ¶
type MicroServiceData ¶
type NodeData ¶
type NodeData struct { // core.NodeSystemInfo core.NodeStatus `json:",inline"` Name string `json:"name"` UID types.UID `json:"uid"` ResourceVersion string `json:"resourceVersion"` }
func (*NodeData) UpdateNodeData ¶
type ObjectData ¶
type ObjectData struct { Created EventObjectData `json:"create,omitempty"` Deleted EventObjectData `json:"delete,omitempty"` Updated EventObjectData `json:"update,omitempty"` }
func NewObjectData ¶ added in v0.1.26
func NewObjectData() *ObjectData
func (*ObjectData) AddToJsonFormatByState ¶
func (obj *ObjectData) AddToJsonFormatByState(NewData interface{}, stype StateType)
type OwnerDet ¶
type OwnerDet struct { Name string `json:"name"` Kind string `json:"kind"` OwnerData interface{} `json:"ownerData,omitempty"` }
func GetAncestorFromLocalPodsList ¶
func GetAncestorFromLocalPodsList(pod *core.Pod, wh *WatchHandler) (*OwnerDet, error)
func GetAncestorOfPod ¶
type OwnerDetNameAndKindOnly ¶
type PodDataForExistMicroService ¶
type PodDataForExistMicroService struct { UID types.UID `json:"uid"` ResourceVersion string `json:"resourceVersion"` PodName string `json:"podName"` NodeName string `json:"nodeName"` PodIP string `json:"podIP"` Namespace string `json:"namespace,omitempty"` Owner OwnerDetNameAndKindOnly `json:"uptreeOwner"` PodStatus string `json:"podStatus"` CreationTimestamp string `json:"startedAt"` DeletionTimestamp string `json:"terminatedAt,omitempty"` }
type ScanNewImageData ¶
type WatchHandler ¶
type WatchHandler struct { RestAPIClient kubernetes.Interface K8sApi *k8sinterface.KubernetesApi WebSocketHandle *WebSocketHandler // contains filtered or unexported fields }
func CreateWatchHandler ¶
func CreateWatchHandler(config config.IConfig) (*WatchHandler, error)
func (*WatchHandler) Cancel ¶ added in v0.1.26
func (wh *WatchHandler) Cancel()
func (*WatchHandler) CheckInstanceMetadataAPIVendor ¶ added in v0.1.26
func (wh *WatchHandler) CheckInstanceMetadataAPIVendor() string
func (*WatchHandler) ClusterVersion ¶ added in v0.1.26
func (wh *WatchHandler) ClusterVersion() *version.Info
func (*WatchHandler) CronJobWatch ¶
func (wh *WatchHandler) CronJobWatch(ctx context.Context)
CronJobWatch watch over services
func (*WatchHandler) ListenAndProcess ¶
func (wh *WatchHandler) ListenAndProcess(ctx context.Context, processor EventProcessor)
func (*WatchHandler) NamespaceEventHandler ¶
func (*WatchHandler) NamespaceWatch ¶
func (wh *WatchHandler) NamespaceWatch(ctx context.Context)
namespaceWatch watch over namespaces
func (*WatchHandler) NodeWatch ¶
func (wh *WatchHandler) NodeWatch(ctx context.Context)
NodeWatch Watching over nodes
func (*WatchHandler) PodWatch ¶
func (wh *WatchHandler) PodWatch(ctx context.Context)
PodWatch - an infinite loop which will observe changes in pods and acts accordingly
func (*WatchHandler) RemoveNamespace ¶
func (wh *WatchHandler) RemoveNamespace(namespace *corev1.Namespace) string
RemoveNamespace update websocket when namespace is removed
func (*WatchHandler) RemovePod ¶
RemovePod remove pod and check if has parents. Returns 3 elements: 1. pod spec ID, 2. is owner removed, 3. owner
func (*WatchHandler) Reset ¶ added in v0.1.26
func (wh *WatchHandler) Reset()
func (*WatchHandler) RetrieveClusterInfo ¶ added in v0.1.26
func (wh *WatchHandler) RetrieveClusterInfo()
func (*WatchHandler) SecretWatch ¶
func (wh *WatchHandler) SecretWatch(ctx context.Context)
SecretWatch watch over secrets
func (*WatchHandler) SendMessageToWebSocket ¶
func (wh *WatchHandler) SendMessageToWebSocket(jsonData []byte)
func (*WatchHandler) ServiceWatch ¶
func (wh *WatchHandler) ServiceWatch(ctx context.Context)
ServiceWatch watch over services
func (*WatchHandler) SetFirstReportFlag ¶
func (wh *WatchHandler) SetFirstReportFlag(first bool)
SetFirstReportFlag set first report flag
func (*WatchHandler) UpdateNamespace ¶
func (wh *WatchHandler) UpdateNamespace(namespace *corev1.Namespace)
UpdateNamespace update websocket when namespace is updated
type WebSocketHandler ¶
type WebSocketHandler struct { SignalChan chan os.Signal // contains filtered or unexported fields }
func (*WebSocketHandler) SendReportRoutine ¶
func (wsh *WebSocketHandler) SendReportRoutine(ctx context.Context, isServerReady *bool, reconnectCallback func(bool)) error
SendReportRoutine function sending updates
type WebSocketProcessor ¶
type WebSocketProcessor struct {
WatchHandler *WatchHandler
}
func (*WebSocketProcessor) ProcessEventData ¶
func (wsh *WebSocketProcessor) ProcessEventData(data []byte)
Source Files ¶
- cancel.go
- cloudinstancemetadataapi.go
- clusterinforetriever.go
- cronjobwatch.go
- deepcopy.go
- eventprocessor.go
- globals.go
- hashbytearray.go
- idmanagment.go
- inclusternotifier.go
- jsonformat.go
- namespacewatch.go
- nodewatch.go
- podwatch.go
- secretwatch.go
- servicewatch.go
- watchhandler.go
- watchlistener.go
- websocket.go