Documentation ¶
Overview ¶
Package targets provides the means to list and resolve targets for probers in the cloudprober framework. To learn more about the kinds of targets available, first look at the "targets.proto" to see how targets are configured.
The interface targets.Targets is what actually provides the ability to list targets (or, more generally, resources), and is what is used by probers. The targets.New constructor provides a specific Target implementation that wraps filtering functionality over a core target lister.
Package targets is a generated protocol buffer package.
It is generated from these files:
github.com/google/cloudprober/targets/targets.proto
It has these top-level messages:
TargetsDef DummyTargets GlobalTargetsOptions
Index ¶
- Constants
- func RegisterTargetsType(extensionFieldNo int, ...)
- type DummyTargets
- type GlobalTargetsOptions
- func (*GlobalTargetsOptions) Descriptor() ([]byte, []int)
- func (m *GlobalTargetsOptions) GetGlobalGceTargetsOptions() *cloudprober_targets_gce.GlobalOptions
- func (m *GlobalTargetsOptions) GetLameDuckOptions() *cloudprober_targets_lameduck.Options
- func (*GlobalTargetsOptions) ProtoMessage()
- func (m *GlobalTargetsOptions) Reset()
- func (m *GlobalTargetsOptions) String() string
- type Targets
- type TargetsDef
- func (*TargetsDef) Descriptor() ([]byte, []int)
- func (*TargetsDef) ExtensionRangeArray() []proto.ExtensionRange
- func (m *TargetsDef) GetDummyTargets() *DummyTargets
- func (m *TargetsDef) GetExcludeLameducks() bool
- func (m *TargetsDef) GetGceTargets() *cloudprober_targets_gce.TargetsConf
- func (m *TargetsDef) GetHostNames() string
- func (m *TargetsDef) GetReEvalSec() int32
- func (m *TargetsDef) GetRegex() string
- func (m *TargetsDef) GetRtcTargets() *cloudprober_targets_rtc.TargetsConf
- func (m *TargetsDef) GetType() isTargetsDef_Type
- func (*TargetsDef) ProtoMessage()
- func (m *TargetsDef) Reset()
- func (m *TargetsDef) String() string
- func (*TargetsDef) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, ...)
- type TargetsDef_DummyTargets
- type TargetsDef_GceTargets
- type TargetsDef_HostNames
- type TargetsDef_RtcTargets
Constants ¶
const Default_TargetsDef_ExcludeLameducks bool = true
const Default_TargetsDef_ReEvalSec int32 = 0
Variables ¶
This section is empty.
Functions ¶
func RegisterTargetsType ¶
func RegisterTargetsType(extensionFieldNo int, newTargetsFunc func(interface{}, *logger.Logger) (Targets, error))
RegisterTargetsType registers a new targets type. New targets types are integrated with the config subsystem using the protobuf extensions.
TODO: Add a full example of using extensions.
Types ¶
type DummyTargets ¶
type DummyTargets struct {
XXX_unrecognized []byte `json:"-"`
}
DummyTargets represent empty targets, which are useful for external probes that do not have any "proper" targets. Such as ilbprober.
func (*DummyTargets) Descriptor ¶
func (*DummyTargets) Descriptor() ([]byte, []int)
func (*DummyTargets) ProtoMessage ¶
func (*DummyTargets) ProtoMessage()
func (*DummyTargets) Reset ¶
func (m *DummyTargets) Reset()
func (*DummyTargets) String ¶
func (m *DummyTargets) String() string
type GlobalTargetsOptions ¶
type GlobalTargetsOptions struct { // GCE targets options. GlobalGceTargetsOptions *cloudprober_targets_gce.GlobalOptions `` /* 127-byte string literal not displayed */ // Lame duck options. If provided, targets module checks for the lame duck // targets and removes them from the targets list. LameDuckOptions *cloudprober_targets_lameduck.Options `protobuf:"bytes,2,opt,name=lame_duck_options,json=lameDuckOptions" json:"lame_duck_options,omitempty"` XXX_unrecognized []byte `json:"-"` }
Global targets options. These options are independent of the per-probe targets which are defined by the "Targets" type above.
Currently these options are used only for GCE targets to control things like how often to re-evaluate the targets and whether to check for lame ducks or not.
func (*GlobalTargetsOptions) Descriptor ¶
func (*GlobalTargetsOptions) Descriptor() ([]byte, []int)
func (*GlobalTargetsOptions) GetGlobalGceTargetsOptions ¶
func (m *GlobalTargetsOptions) GetGlobalGceTargetsOptions() *cloudprober_targets_gce.GlobalOptions
func (*GlobalTargetsOptions) GetLameDuckOptions ¶
func (m *GlobalTargetsOptions) GetLameDuckOptions() *cloudprober_targets_lameduck.Options
func (*GlobalTargetsOptions) ProtoMessage ¶
func (*GlobalTargetsOptions) ProtoMessage()
func (*GlobalTargetsOptions) Reset ¶
func (m *GlobalTargetsOptions) Reset()
func (*GlobalTargetsOptions) String ¶
func (m *GlobalTargetsOptions) String() string
type Targets ¶
type Targets interface {
// contains filtered or unexported methods
}
Targets are able to list and resolve targets with their List and Resolve methods. A single instance of Targets represents a specific listing method --- if multiple sets of resources need to be listed/resolved, a separate instance of Targets will be needed.
func New ¶
func New(targetsDef *TargetsDef, ldLister lameduck.Lister, targetOpts *GlobalTargetsOptions, globalLogger, l *logger.Logger) (Targets, error)
New returns an instance of Targets as defined by a Targets protobuf (and a GlobalTargetsOptions protobuf). The Targets instance returned will filter a core target lister (i.e. static host-list, GCE instances, GCE forwarding rules, RTC targets) by an optional regex or with the lameduck mechanism.
All information related to creating the Target instance will be logged to globalLogger. The logger "l" will be given to the new Targets instance for future logging. If "l" is not provided, a default instance will be given.
See cloudprober/targets/targets.proto for more information on the possible configurations of Targets.
func StaticTargets ¶
StaticTargets returns a basic "targets" object (implementing the targets interface) from a comma-separated list of hosts. This function is specially useful if you want to get a valid targets object without an associated TargetDef protobuf (for example for testing).
type TargetsDef ¶
type TargetsDef struct { // Types that are valid to be assigned to Type: // *TargetsDef_HostNames // *TargetsDef_GceTargets // *TargetsDef_RtcTargets // *TargetsDef_DummyTargets Type isTargetsDef_Type `protobuf_oneof:"type"` // Regex to apply on the targets. Regex *string `protobuf:"bytes,4,opt,name=regex" json:"regex,omitempty"` // Exclude lameducks. Lameduck targets can be set through RTC (realtime // configurator) service. This functionality works only if lame_duck_options // are specified. ExcludeLameducks *bool `protobuf:"varint,5,opt,name=exclude_lameducks,json=excludeLameducks,def=1" json:"exclude_lameducks,omitempty"` // How often targets should be evaluated. Any number less than or equal to 0 // will result in no target caching (targets will be reevaluated on demand). // Note that individual target types may have their own caches implemented // (specifically GCE instances/forwarding rules). This does not impact those // caches. ReEvalSec *int32 `protobuf:"varint,6,opt,name=re_eval_sec,json=reEvalSec,def=0" json:"re_eval_sec,omitempty"` proto.XXX_InternalExtensions `json:"-"` XXX_unrecognized []byte `json:"-"` }
func (*TargetsDef) Descriptor ¶
func (*TargetsDef) Descriptor() ([]byte, []int)
func (*TargetsDef) ExtensionRangeArray ¶
func (*TargetsDef) ExtensionRangeArray() []proto.ExtensionRange
func (*TargetsDef) GetDummyTargets ¶
func (m *TargetsDef) GetDummyTargets() *DummyTargets
func (*TargetsDef) GetExcludeLameducks ¶
func (m *TargetsDef) GetExcludeLameducks() bool
func (*TargetsDef) GetGceTargets ¶
func (m *TargetsDef) GetGceTargets() *cloudprober_targets_gce.TargetsConf
func (*TargetsDef) GetHostNames ¶
func (m *TargetsDef) GetHostNames() string
func (*TargetsDef) GetReEvalSec ¶
func (m *TargetsDef) GetReEvalSec() int32
func (*TargetsDef) GetRegex ¶
func (m *TargetsDef) GetRegex() string
func (*TargetsDef) GetRtcTargets ¶
func (m *TargetsDef) GetRtcTargets() *cloudprober_targets_rtc.TargetsConf
func (*TargetsDef) GetType ¶
func (m *TargetsDef) GetType() isTargetsDef_Type
func (*TargetsDef) ProtoMessage ¶
func (*TargetsDef) ProtoMessage()
func (*TargetsDef) Reset ¶
func (m *TargetsDef) Reset()
func (*TargetsDef) String ¶
func (m *TargetsDef) String() string
func (*TargetsDef) XXX_OneofFuncs ¶
func (*TargetsDef) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{})
XXX_OneofFuncs is for the internal use of the proto package.
type TargetsDef_DummyTargets ¶
type TargetsDef_DummyTargets struct {
DummyTargets *DummyTargets `protobuf:"bytes,7,opt,name=dummy_targets,json=dummyTargets,oneof"`
}
type TargetsDef_GceTargets ¶
type TargetsDef_GceTargets struct {
GceTargets *cloudprober_targets_gce.TargetsConf `protobuf:"bytes,2,opt,name=gce_targets,json=gceTargets,oneof"`
}
type TargetsDef_HostNames ¶
type TargetsDef_HostNames struct {
HostNames string `protobuf:"bytes,1,opt,name=host_names,json=hostNames,oneof"`
}
type TargetsDef_RtcTargets ¶
type TargetsDef_RtcTargets struct {
RtcTargets *cloudprober_targets_rtc.TargetsConf `protobuf:"bytes,3,opt,name=rtc_targets,json=rtcTargets,oneof"`
}
Directories ¶
Path | Synopsis |
---|---|
Package gce is a generated protocol buffer package.
|
Package gce is a generated protocol buffer package. |
Package lameduck is a generated protocol buffer package.
|
Package lameduck is a generated protocol buffer package. |
Package resolver provides a caching, non-blocking DNS resolver.
|
Package resolver provides a caching, non-blocking DNS resolver. |
Package rtc is a generated protocol buffer package.
|
Package rtc is a generated protocol buffer package. |
rtcreporter
Package rtcreporter implements a reporting mechanism for RTC targets.
|
Package rtcreporter implements a reporting mechanism for RTC targets. |
rtcservice
Package rtcservice provides utility functions for the cloudprober project used when dealing with the Runtime Configurator API.
|
Package rtcservice provides utility functions for the cloudprober project used when dealing with the Runtime Configurator API. |