Versions in this module Expand all Collapse all v2 v2.9.0 Oct 28, 2020 Changes in this version type Observer + func (observer *Observer) FindContainer(namespaceName string, controllerKind string, controllerName string, ...) (*corev1.Container, error) + func (observer *Observer) FindPodController(namespaceName string, podName string) (string, string, error) v2.8.0 Sep 15, 2020 Changes in this version + var ClusterRoleBindings = GroupVersionResourceKind + var ClusterRoles = GroupVersionResourceKind + var IngressClasses = GroupVersionResourceKind + var Ingresses = GroupVersionResourceKind + var NetworkPolicies = GroupVersionResourceKind + var PersistentVolumeClaims = GroupVersionResourceKind + var PersistentVolumes = GroupVersionResourceKind + var RoleBindings = GroupVersionResourceKind + var Roles = GroupVersionResourceKind + var ServiceAccounts = GroupVersionResourceKind + var Services = GroupVersionResourceKind + var StorageClasses = GroupVersionResourceKind type Kube + func (kube *Kube) GetAgentPermissions() (string, error) + func (kube *Kube) GetServerMinorVersion() (int, error) v2.6.1 Aug 25, 2020 Changes in this version type Kube + ClientV1 *kapps.AppsV1Client + func (kube *Kube) GetCronJob(namespace, name string) (*kbeta1.CronJob, error) + func (kube *Kube) GetDaemonSet(namespace, name string) (*v1.DaemonSet, error) + func (kube *Kube) GetNameSpacePods(namespace string) (*kv1.PodList, error) + func (kube *Kube) GetNamespaceReplicaSets(namespace string) (*appsV1.ReplicaSetList, error) + func (kube *Kube) GetServerVersion() (string, error) v2.0.0 Apr 7, 2020 Changes in this version + const NodeRoleLabelPrefix + var CronJobs = GroupVersionResourceKind + var DaemonSets = GroupVersionResourceKind + var Deployments = GroupVersionResourceKind + var Jobs = GroupVersionResourceKind + var LimitRanges = GroupVersionResourceKind + var Namespaces = GroupVersionResourceKind + var Nodes = GroupVersionResourceKind + var Pods = GroupVersionResourceKind + var ReplicaSets = GroupVersionResourceKind + var ReplicationControllers = GroupVersionResourceKind + var StatefulSets = GroupVersionResourceKind + func GetContainersByNode(pods []corev1.Pod) map[string]int + func GetEntityKey(namespace string, kind string, name string) string + func RangePods(pods []corev1.Pod, fn func(corev1.Pod) bool) error + type Container struct + Cluster string + Image string + Limits *ContainerResources + Name string + Namespace string + Node string + Pod string + Requests *ContainerResources + func GetContainers(pods []corev1.Pod, namespace *string, pod *string, container *string) ([]*Container, error) + type ContainerResources struct + CPU int + Memory int + type ContainerResourcesRequirements struct + Limits RequestLimit + Name string + Requests RequestLimit + type GetWatcherFromKindFunc func(kind string) (Watcher, bool) + type GroupVersionResourceKind struct + Kind string + func KindToGvrk(kind string) (*GroupVersionResourceKind, error) + func (gvrk GroupVersionResourceKind) String() string + type Identifiable interface + GetAPIVersion func() string + GetKind func() string + GetName func() string + GetNamespace func() string + GetOwnerReferences func() []apisv1.OwnerReference + type Kube struct + ClientBatch *batch.BatchV1beta1Client + ClientV1Beta2 *beta2client.AppsV1beta2Client + Clientset *kubernetes.Clientset + func InitKubernetes(config *krest.Config, client *client.Client) (*Kube, error) + func (kube *Kube) GetCronJobs() (*kbeta1.CronJobList, error) + func (kube *Kube) GetDaemonSets() (*kbeta2.DaemonSetList, error) + func (kube *Kube) GetDeployments() (*kbeta2.DeploymentList, error) + func (kube *Kube) GetLimitRanges() (*kv1.LimitRangeList, error) + func (kube *Kube) GetNodes() (*kv1.NodeList, error) + func (kube *Kube) GetPods() (*kv1.PodList, error) + func (kube *Kube) GetReplicaSets() (*kbeta2.ReplicaSetList, error) + func (kube *Kube) GetReplicationControllers() (*kv1.ReplicationControllerList, error) + func (kube *Kube) GetResources() (pods []kv1.Pod, limitRanges []kv1.LimitRange, resources []Resource, ...) + func (kube *Kube) GetStatefulSet(namespace, name string) (*v1.StatefulSet, error) + func (kube *Kube) GetStatefulSets() (*kbeta2.StatefulSetList, error) + func (kube *Kube) SetResources(kind string, name string, namespace string, totalResources TotalResources) (skipped bool, err error) + type Node struct + Allocatable NodeCapacity + Capacity NodeCapacity + ContainerList []*Container + Containers int + ID uuid.UUID + IP string + InstanceSize string + InstanceType string + KubeletPort int32 + Name string + Provider string + Region string + Roles string + func AddContainerListToNodes(nodes []Node, pods []corev1.Pod, namespace *string, pod *string, ...) []Node + func GetNodes(nodes []corev1.Node) []Node + func UpdateNodesContainers(nodes []Node, containers map[string]int) []Node + type NodeCapacity struct + CPU int + Memory int + Pods int + StorageEphemeral int + func GetNodeCapacity(resources corev1.ResourceList) NodeCapacity + type Observer struct + ParentsStore *ParentsStore + func NewObserver(logger *log.Logger, client dynamic.Interface, parentsStore *ParentsStore, ...) *Observer + func (observer *Observer) FindController(namespaceName string, podName string) (string, string, error) + func (observer *Observer) GetNodes() ([]corev1.Node, error) + func (observer *Observer) GetPods() ([]corev1.Pod, error) + func (observer *Observer) Start() + func (observer *Observer) Stop() + func (observer *Observer) WaitForCacheSync(timeout *time.Duration) error + func (observer *Observer) Watch(gvrk GroupVersionResourceKind) *watcher + func (observer *Observer) WatchAndWaitForSync(gvrk GroupVersionResourceKind) (*watcher, error) + func (observer *Observer) WatcherFor(gvrk GroupVersionResourceKind) *watcher + type ParentController struct + APIVersion string + IsWatched bool + Kind string + Name string + Parent *ParentController + func GetParents(obj Identifiable, parentsStore *ParentsStore, ...) (*ParentController, error) + func RootParent(parent *ParentController) *ParentController + type ParentsStore struct + func NewParentsStore() *ParentsStore + func (s *ParentsStore) Delete(namespace string, kind string, name string) + func (s *ParentsStore) GetParents(namespace string, kind string, name string) (*ParentController, bool) + func (s *ParentsStore) SetParents(namespace string, kind string, name string, parent *ParentController) + type RawResources struct + CronJobList *kbeta1.CronJobList + DaemonSetList *kbeta2.DaemonSetList + DeploymentList *kbeta2.DeploymentList + LimitRangeList *kv1.LimitRangeList + PodList *kv1.PodList + ReplicaSetList *kbeta2.ReplicaSetList + StatefulSetList *kbeta2.StatefulSetList + type RequestLimit struct + CPU *int64 + Memory *int64 + type Resource struct + Annotations map[string]string + Containers []kv1.Container + Kind string + Name string + Namespace string + PodRegexp *regexp.Regexp + ReplicasStatus proto.ReplicasStatus + type ResourceEventHandler interface + OnAdd func(now time.Time, gvrk GroupVersionResourceKind, obj unstructured.Unstructured) + OnDelete func(now time.Time, gvrk GroupVersionResourceKind, obj unstructured.Unstructured) + OnUpdate func(now time.Time, gvrk GroupVersionResourceKind, ...) + type ResourceEventHandlerFuncs struct + AddFunc func(now time.Time, gvrk GroupVersionResourceKind, obj unstructured.Unstructured) + DeleteFunc func(now time.Time, gvrk GroupVersionResourceKind, obj unstructured.Unstructured) + Observer *Observer + UpdateFunc func(now time.Time, gvrk GroupVersionResourceKind, ...) + func (r ResourceEventHandlerFuncs) OnAdd(now time.Time, gvrk GroupVersionResourceKind, obj unstructured.Unstructured) + func (r ResourceEventHandlerFuncs) OnDelete(now time.Time, gvrk GroupVersionResourceKind, obj unstructured.Unstructured) + func (r ResourceEventHandlerFuncs) OnUpdate(now time.Time, gvrk GroupVersionResourceKind, ...) + type TotalResources struct + Containers []ContainerResourcesRequirements + Replicas *int + type Watcher interface + AddEventHandler func(handler ResourceEventHandler) + AddEventHandlerWithResyncPeriod func(handler ResourceEventHandler, resyncPeriod time.Duration) + GetGroupVersionResourceKind func() GroupVersionResourceKind + HasSynced func() bool + LastSyncResourceVersion func() string + Lister func() cache.GenericLister Other modules containing this package github.com/MagalixCorp/magalix-agent github.com/MagalixCorp/magalix-agent/v3