Documentation
¶
Index ¶
- type Agent
- func (a *Agent) GetPodResources(ns, pod string, timeout time.Duration) (*podresapi.PodResources, error)
- func (a *Agent) GoGetPodResources(ns, pod string, timeout time.Duration) <-chan *podresapi.PodResources
- func (a *Agent) GoListPodResources(timeout time.Duration) <-chan *podresapi.PodResourcesList
- func (a *Agent) ListPodResources(timeout time.Duration) (*podresapi.PodResourcesList, error)
- func (a *Agent) PurgePodResources(ns, pod string)
- func (a *Agent) Start(notifyFn NotifyFn) error
- func (a *Agent) Stop()
- func (a *Agent) UpdateNodeExtendedResources(resources map[string]*resource.Quantity) error
- func (a *Agent) UpdateNrtCR(policy string, zones []*policyapi.TopologyZone) error
- type ConfigInterface
- type NotifyFn
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Agent ¶
type Agent struct {
// contains filtered or unexported fields
}
Agent provides access to configuration stored as custom resources.
Configuration custom resources can be defined per node, per group or as a default resource. These are named 'node.$NODE_NAME', 'group.$GROUP_NAME', and 'default' respectively. If a node-specific configuration exists, it is always used for the node. Otherwise either a group-specific or the default configuration is used depending on whether the node belongs to a group. A node can be assigned to a group by setting the group label on the node. By default this group label is 'config.nri/group'.
func New ¶
func New(cfgIf ConfigInterface, options ...Option) (*Agent, error)
New creates an agent with the given options.
func (*Agent) GetPodResources ¶ added in v0.8.0
func (a *Agent) GetPodResources(ns, pod string, timeout time.Duration) (*podresapi.PodResources, error)
GetPodResources queries the given pod's resources.
func (*Agent) GoGetPodResources ¶ added in v0.8.0
func (a *Agent) GoGetPodResources(ns, pod string, timeout time.Duration) <-chan *podresapi.PodResources
GoGetPodResources queries the given pod's resources asynchronously.
func (*Agent) GoListPodResources ¶ added in v0.8.0
func (a *Agent) GoListPodResources(timeout time.Duration) <-chan *podresapi.PodResourcesList
GoListPodResources lists all pods' resources asynchronously.
func (*Agent) ListPodResources ¶ added in v0.8.0
ListPodResources lists all pods' resources.
func (*Agent) PurgePodResources ¶ added in v0.9.4
PurgePodResources removes any cached resources for the given pod.
func (*Agent) UpdateNodeExtendedResources ¶ added in v0.13.0
UpdateNodeExtendedResources records 'resources' as the desired state of the local Node's status.capacity and wakes the reconciler to take care of status change.
'resources' must describe the *complete* desired state:
- A non-nil value publishes (adds/replaces) the named resource with the given capacity.
- A nil value whose key contains no '*' removes that exact resource if it is currently present on the Node.
- A nil value whose key contains '*' is an ownership pattern: every resource currently on the Node that matches the pattern but is not being published is removed.
If the resources map is empty or nil, nothing is to be published or removed, and therefore querying and modifying Node status/capacity is omitted.
Because every request carries the full desired state, a newer request fully supersedes older ones; the reconciler therefore coalesces bursts and only ever drives the Node towards the most recent request.
func (*Agent) UpdateNrtCR ¶
func (a *Agent) UpdateNrtCR(policy string, zones []*policyapi.TopologyZone) error
UpdateNrtCR updates the node's node resource topology CR using the given data.
type ConfigInterface ¶
type ConfigInterface interface {
// Set the preferred client and configuration for cluster/apiserver access.
SetKubeClient(cli *http.Client, cfg *rest.Config) error
// Create a watch for monitoring the named custom resource.
CreateWatch(ctx context.Context, namespace, name string) (watch.Interface, error)
// Patch the status subresource of the named custom resource.
PatchStatus(ctx context.Context, namespace, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions) error
// Unmarshal custom resource which was read from the given file.
Unmarshal(data []byte, file string) (runtime.Object, error)
}
ConfigInterface is used by the agent to access config custom resources.
func BalloonsConfigInterface ¶
func BalloonsConfigInterface() ConfigInterface
BalloonsConfigInterface returns a ConfigInterface for the balloons policy.
func TemplateConfigInterface ¶
func TemplateConfigInterface() ConfigInterface
TemplateConfigInterface returns a ConfigInterface for the template policy.
func TopologyAwareConfigInterface ¶
func TopologyAwareConfigInterface() ConfigInterface
TopologyAwareConfigInterface returns a ConfigInterface for the topology-aware policy.
type Option ¶
Option is an option for the agent.
func WithConfigFile ¶
WithConfigFile sets up the agent to monitor a configuration file instead of custom resources.
func WithConfigGroupLabel ¶
WithConfigGroupLabel sets the key used to label nodes into config groups.
func WithConfigNamespace ¶
WithConfigNamespace sets the namespace used for config custom resources.
func WithKubeConfig ¶
WithKubeConfig sets the location of the config file to use for K8s cluster access. An unset config file implies in-cluster configuration or lack of need for cluster access.