Documentation ¶
Index ¶
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 'group.config.nri'.
func New ¶
func New(cfgIf ConfigInterface, options ...Option) (*Agent, error)
New creates an agent with the given options.
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 NotifyFn ¶
type NotifyFn func(cfg interface{}) error
NotifyFn is a function to call when the effective configuration changes.
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.