Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewFilteredSource ¶
func NewFilteredSource(log hclog.Logger, upstreamSource policy.Source, filter PolicyFilter) policy.Source
NewFilteredSource accepts an upstream policy.Source and an ha.PolicyFilter and constructs a FilteredSource
Types ¶
type FilteredSource ¶
type FilteredSource struct {
// contains filtered or unexported fields
}
FilteredSource is a policy.Source which accepts policy IDs from an upstream policy.Source and filters them through an ha.PolicyFilter
func (*FilteredSource) MonitorIDs ¶
func (fs *FilteredSource) MonitorIDs(ctx context.Context, req policy.MonitorIDsReq)
MonitorIDs calls the same method on the configured upstream policy.Source, and filters the discovered policy IDs using the configured PolicyFilter.
func (*FilteredSource) MonitorPolicy ¶
func (fs *FilteredSource) MonitorPolicy(ctx context.Context, req policy.MonitorPolicyReq)
MonitorPolicy calls the same method on the configured policy.Source. This method doesn't need to worry about the policy filter, because the policy.Manager will close the context if the corresponding policy is removed.
func (*FilteredSource) Name ¶
func (fs *FilteredSource) Name() policy.SourceName
Name satisfies the Name function of the policy.Source interface.
func (*FilteredSource) ReloadIDsMonitor ¶
func (fs *FilteredSource) ReloadIDsMonitor()
ReloadIDsMonitor implements policy.Source by calling the appropriate reload method on the underlying policy source and filter.
type MonitorFilterRequest ¶
type MonitorFilterRequest struct { ErrCh chan<- error UpdateCh chan<- struct{} }
type PolicyFilter ¶
type PolicyFilter interface { // MonitorFilterUpdates accepts a context and a channel for informing the caller // of asynchronous updates to the underlying filter. MonitorFilterUpdates(ctx context.Context, req MonitorFilterRequest) // ReloadFilterMonitor indicates that the filter should be reloaded // due to potential changes to configuration and/or clients. ReloadFilterMonitor() // FilterPolicies should return a list of policies appropriate for this // autoscaler agent; policies for other autoscaler agents in the HA pool // should be neglected from the returned slice. FilterPolicies(policyIDs []policy.PolicyID) []policy.PolicyID }
PolicyFilter defines the interface for policy filters used by the autoscaler's HA capability.