Documentation ¶
Index ¶
- Variables
- func GetEntityKey(namespace string, kind string, name string) string
- type ContainerResourcesRequirements
- type GetWatcherFromKindFunc
- type GroupVersionResourceKind
- type Identifiable
- type Kube
- type Observer
- func (observer *Observer) FindContainer(namespaceName string, controllerKind string, controllerName string, ...) (*corev1.Container, error)
- func (observer *Observer) FindController(namespaceName string, controllerKind string, controllerName string) (*unstructured.Unstructured, error)
- func (observer *Observer) FindPodController(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() 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
- type ParentsStore
- type RawResources
- type RequestLimit
- type Resource
- type ResourceEventHandler
- type ResourceEventHandlerFuncs
- func (r ResourceEventHandlerFuncs) OnAdd(gvrk GroupVersionResourceKind, obj unstructured.Unstructured)
- func (r ResourceEventHandlerFuncs) OnDelete(gvrk GroupVersionResourceKind, obj unstructured.Unstructured)
- func (r ResourceEventHandlerFuncs) OnUpdate(gvrk GroupVersionResourceKind, oldObj, newObj unstructured.Unstructured)
- type TotalResources
- type Watcher
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Nodes = GroupVersionResourceKind{ GroupVersionResource: corev1.SchemeGroupVersion.WithResource("nodes"), Kind: "Node", } Namespaces = GroupVersionResourceKind{ GroupVersionResource: corev1.SchemeGroupVersion.WithResource("namespaces"), Kind: "Namespace", } LimitRanges = GroupVersionResourceKind{ GroupVersionResource: corev1.SchemeGroupVersion.WithResource("limitranges"), Kind: "LimitRange", } Pods = GroupVersionResourceKind{ GroupVersionResource: corev1.SchemeGroupVersion.WithResource("pods"), Kind: "Pod", } ReplicationControllers = GroupVersionResourceKind{ GroupVersionResource: corev1.SchemeGroupVersion.WithResource("replicationcontrollers"), Kind: "ReplicationController", } Deployments = GroupVersionResourceKind{ GroupVersionResource: appsv1.SchemeGroupVersion.WithResource("deployments"), Kind: "Deployment", } StatefulSets = GroupVersionResourceKind{ GroupVersionResource: appsv1.SchemeGroupVersion.WithResource("statefulsets"), Kind: "StatefulSet", } DaemonSets = GroupVersionResourceKind{ GroupVersionResource: appsv1.SchemeGroupVersion.WithResource("daemonsets"), Kind: "DaemonSet", } ReplicaSets = GroupVersionResourceKind{ GroupVersionResource: appsv1.SchemeGroupVersion.WithResource("replicasets"), Kind: "ReplicaSet", } Jobs = GroupVersionResourceKind{ GroupVersionResource: batchv1.SchemeGroupVersion.WithResource("jobs"), Kind: "Job", } CronJobs = GroupVersionResourceKind{ GroupVersionResource: batchv1beta1.SchemeGroupVersion.WithResource("cronjobs"), Kind: "CronJob", } Ingresses = GroupVersionResourceKind{ GroupVersionResource: networkingv1beta1.SchemeGroupVersion.WithResource("ingresses"), Kind: "Ingress", } IngressClasses = GroupVersionResourceKind{ GroupVersionResource: networkingv1beta1.SchemeGroupVersion.WithResource("ingressclasses"), Kind: "IngressClass", } NetworkPolicies = GroupVersionResourceKind{ GroupVersionResource: networkingv1.SchemeGroupVersion.WithResource("networkpolicies"), Kind: "NetworkPolicy", } Services = GroupVersionResourceKind{ GroupVersionResource: corev1.SchemeGroupVersion.WithResource("services"), Kind: "Service", } PersistentVolumes = GroupVersionResourceKind{ GroupVersionResource: corev1.SchemeGroupVersion.WithResource("persistentvolumes"), Kind: "PersistentVolume", } PersistentVolumeClaims = GroupVersionResourceKind{ GroupVersionResource: corev1.SchemeGroupVersion.WithResource("persistentvolumeclaims"), Kind: "PersistentVolumeClaim", } StorageClasses = GroupVersionResourceKind{ GroupVersionResource: storagev1.SchemeGroupVersion.WithResource("storageclasses"), Kind: "StorageClass", } Roles = GroupVersionResourceKind{ GroupVersionResource: rbacv1.SchemeGroupVersion.WithResource("roles"), Kind: "Role", } RoleBindings = GroupVersionResourceKind{ GroupVersionResource: rbacv1.SchemeGroupVersion.WithResource("rolebindings"), Kind: "RoleBinding", } ClusterRoles = GroupVersionResourceKind{ GroupVersionResource: rbacv1.SchemeGroupVersion.WithResource("clusterroles"), Kind: "ClusterRole", } ClusterRoleBindings = GroupVersionResourceKind{ GroupVersionResource: rbacv1.SchemeGroupVersion.WithResource("clusterrolebindings"), Kind: "ClusterRoleBinding", } ServiceAccounts = GroupVersionResourceKind{ GroupVersionResource: corev1.SchemeGroupVersion.WithResource("serviceaccounts"), Kind: "ServiceAccount", } )
Functions ¶
Types ¶
type ContainerResourcesRequirements ¶
type ContainerResourcesRequirements struct { Name string Requests *RequestLimit Limits *RequestLimit }
ContainerResources container resources
type GetWatcherFromKindFunc ¶
type GroupVersionResourceKind ¶
type GroupVersionResourceKind struct { schema.GroupVersionResource Kind string }
func KindToGVRK ¶ added in v3.4.0
func KindToGVRK(kind string) (*GroupVersionResourceKind, error)
func (GroupVersionResourceKind) String ¶
func (gvrk GroupVersionResourceKind) String() string
type Identifiable ¶
type Kube ¶
type Kube struct { Clientset *kubernetes.Clientset ClientV1 *kapps.AppsV1Client ClientBatch *batch.BatchV1beta1Client // contains filtered or unexported fields }
Kube kube struct
func (*Kube) GetAgentPermissions ¶
func (*Kube) GetServerMinorVersion ¶
func (*Kube) GetServerVersion ¶
type Observer ¶
type Observer struct { ParentsStore *ParentsStore // contains filtered or unexported fields }
func NewObserver ¶
func (*Observer) FindContainer ¶
func (*Observer) FindController ¶
func (observer *Observer) FindController(namespaceName string, controllerKind string, controllerName string) (*unstructured.Unstructured, error)
func (*Observer) FindPodController ¶
func (*Observer) WaitForCacheSync ¶
func (*Observer) Watch ¶
func (observer *Observer) Watch(gvrk GroupVersionResourceKind) *watcher
func (*Observer) WatchAndWaitForSync ¶
func (observer *Observer) WatchAndWaitForSync(gvrk GroupVersionResourceKind) (*watcher, error)
func (*Observer) WatcherFor ¶
func (observer *Observer) WatcherFor(gvrk GroupVersionResourceKind) *watcher
type ParentController ¶
type ParentController struct { Kind string `json:"kind"` Name string `json:"name"` APIVersion string `json:"api_version"` IsWatched bool `json:"is_watched"` Parent *ParentController `json:"parent"` }
func GetParents ¶
func GetParents( obj Identifiable, parentsStore *ParentsStore, getWatcher GetWatcherFromKindFunc, ) (*ParentController, error)
func RootParent ¶
func RootParent(parent *ParentController) *ParentController
type ParentsStore ¶
TODO: Extract into a dependency
func NewParentsStore ¶
func NewParentsStore() *ParentsStore
func (*ParentsStore) Delete ¶
func (s *ParentsStore) Delete(namespace string, kind string, name string)
func (*ParentsStore) GetParents ¶
func (s *ParentsStore) GetParents(namespace string, kind string, name string) (*ParentController, bool)
func (*ParentsStore) SetParents ¶
func (s *ParentsStore) SetParents(namespace string, kind string, name string, parent *ParentController)
type RawResources ¶
type RawResources struct { PodList *kv1.PodList LimitRangeList *kv1.LimitRangeList CronJobList *kbeta1.CronJobList DeploymentList *appsV1.DeploymentList StatefulSetList *appsV1.StatefulSetList DaemonSetList *appsV1.DaemonSetList ReplicaSetList *appsV1.ReplicaSetList }
type RequestLimit ¶
RequestLimit request limit
type ResourceEventHandler ¶
type ResourceEventHandler interface { OnAdd(gvrk GroupVersionResourceKind, obj unstructured.Unstructured) OnUpdate(gvrk GroupVersionResourceKind, oldObj, newObj unstructured.Unstructured) OnDelete(gvrk GroupVersionResourceKind, obj unstructured.Unstructured) }
type ResourceEventHandlerFuncs ¶
type ResourceEventHandlerFuncs struct { Observer *Observer AddFunc func(gvrk GroupVersionResourceKind, obj unstructured.Unstructured) UpdateFunc func(gvrk GroupVersionResourceKind, oldObj, newObj unstructured.Unstructured) DeleteFunc func(gvrk GroupVersionResourceKind, obj unstructured.Unstructured) }
ResourceEventHandlerFuncs is an adaptor to let you easily specify as many or as few of the notification functions as you want while still implementing ResourceEventHandler.
func (ResourceEventHandlerFuncs) OnAdd ¶
func (r ResourceEventHandlerFuncs) OnAdd(gvrk GroupVersionResourceKind, obj unstructured.Unstructured)
OnAdd calls AddFunc if it's not nil.
func (ResourceEventHandlerFuncs) OnDelete ¶
func (r ResourceEventHandlerFuncs) OnDelete(gvrk GroupVersionResourceKind, obj unstructured.Unstructured)
OnDelete calls DeleteFunc if it's not nil.
func (ResourceEventHandlerFuncs) OnUpdate ¶
func (r ResourceEventHandlerFuncs) OnUpdate(gvrk GroupVersionResourceKind, oldObj, newObj unstructured.Unstructured)
OnUpdate calls UpdateFunc if it's not nil.
type TotalResources ¶
type TotalResources struct {
Containers []ContainerResourcesRequirements
}
TotalResources service resources and replicas
type Watcher ¶
type Watcher interface { GetGroupVersionResourceKind() GroupVersionResourceKind Lister() cache.GenericLister // AddEventHandler adds an event handler to the shared informer using the shared informer's resync // period. Events to a single handler are delivered sequentially, but there is no coordination // between different handlers. AddEventHandler(handler ResourceEventHandler) // AddEventHandlerWithResyncPeriod adds an event handler to the // shared informer using the specified resync period. The resync // operation consists of delivering to the handler a create // notification for every object in the informer's local cache; it // does not add any interactions with the authoritative storage. AddEventHandlerWithResyncPeriod(handler ResourceEventHandler, resyncPeriod time.Duration) // HasSynced returns true if the shared informer's store has been // informed by at least one full LIST of the authoritative state // of the informer's object collection. This is unrelated to "resync". HasSynced() bool // LastSyncResourceVersion is the resource version observed when last synced with the underlying // store. The value returned is not synchronized with access to the underlying store and is not // thread-safe. LastSyncResourceVersion() string }
Click to show internal directories.
Click to hide internal directories.