rtc

package
v0.0.0-...-eff70b3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 11, 2018 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package rtc is a generated protocol buffer package.

It is generated from these files:

github.com/google/cloudprober/targets/rtc/config.proto

It has these top-level messages:

TargetsConf

Package rtc implements runtime-configurator (RTC) based targets.

Index

Constants

View Source
const Default_TargetsConf_ExpireMsec int32 = 30000
View Source
const Default_TargetsConf_ReEvalSec int32 = 0

Variables

This section is empty.

Functions

This section is empty.

Types

type Targets

type Targets struct {
	// contains filtered or unexported fields
}

Targets implements the lister interface to provide RTC based target listing. Provides a means of listing targets stored in a Runtime Configuration value set. For information on how the RTC API works, see https://cloud.google.com/deployment-manager/runtime-configurator/reference/rest/

Each variable in RTC is a key/val pair. When listing targets, we assume the variables in the rtcservice.Config are laid out as <Hostname : RtcTargetInfo> where RtcTargetInfo is a base64 encoded RtcTargetInfo protobuf. The hostnames are listed, with one of their addresses assigned as a solve address. If groupTag is empty, no filtering by groupTag occurs. Otherwise, only variables with a group_tag matching an element of groupTag will be listed.

Note that this only provides a means to list targets stored in an RTC config. It does not provide means to maintain this list. When listing, however, Targets will ignore sufficiently old RTC entries, as configured by "exp_msec" in the TargetsConf protobuf.

func New

func New(pb *TargetsConf, proj string, l *logger.Logger) (*Targets, error)

New returns an rtc resolver / lister, given a defining protobuf.

func (*Targets) List

func (t *Targets) List() []string

List produces a list of targets found in the RTC configuration for this project. It ignores all sufficiently old RTC entries, as configured by "exp_msec" in the TargetsConf protobuf. Then entries will be filtered by group names, if "groups" was non-empty. If there is an empty intersection between "groups" and the groups in RtcTargetInfo, the entry will be filtered out.

func (*Targets) Resolve

func (t *Targets) Resolve(name string, ipVer int) (net.IP, error)

Resolve returns the address that was associated with a given hostname. ipVer is currently ignored.

type TargetsConf

type TargetsConf struct {
	// Config-name to list hosts from.
	Cfg *string `protobuf:"bytes,1,opt,name=cfg" json:"cfg,omitempty"`
	// Expiration time in ms for RTC variables. Variables older will be ignored.
	ExpireMsec *int32 `protobuf:"varint,2,opt,name=expire_msec,json=expireMsec,def=30000" json:"expire_msec,omitempty"`
	// Which address tag to resolve a hostname to. Hosts report multiple addresses
	// for themselves, each with a "tag" (like "PUBLIC_IP" or "PRIVATE_IP"). For
	// more information, see the "tag" field of the RtcTargetInfo.Address message.
	ResolveTag *string `protobuf:"bytes,3,opt,name=resolve_tag,json=resolveTag" json:"resolve_tag,omitempty"`
	// groups is a list of groups that should be included by the lister. Hosts can
	// assign themselves a set "groups" such as "Zone1" or "HasMultiNIC". If this
	// field is set, then we will filter out hosts that don't have a group that
	// matches any groups listed here. If groups is not set, no filtering will
	// occure.
	//
	// For more information, see the "groups" field of the RtcTargetInfo message.
	//
	// Example :
	//   Host1 has group "G1" and "G2"
	//   Host2 has groups "G2" and "G3"
	//   Host3 has no groups.
	//   The following table shows values for groups and which hosts will be
	//   listed.
	//   groups      | Listed Hosts
	//   ------------|--------------------
	//   ["G1"]      | Host1
	//   ["G2"]      | Host1, Host2
	//   ["G1","G3"] | Host1, Host2
	//   ["G4"]      | None
	//   []          | Host1, Host2, Host3
	Groups []string `protobuf:"bytes,4,rep,name=groups" json:"groups,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).
	ReEvalSec        *int32 `protobuf:"varint,6,opt,name=re_eval_sec,json=reEvalSec,def=0" json:"re_eval_sec,omitempty"`
	XXX_unrecognized []byte `json:"-"`
}

TargetsConf represents listing targets from a key/val set stored in the RTC API under a certain provided configuration. It always only lists the keys (hostnames) and provides a resolver which will resolve to a single tag. This can be used as a kind of drop-in replacement for GCE Instances when that would not be possible. For example, one could set "resolve_tag" to "ip", and this lister will now list all VM names, with a resolver that resolves those names to their ip addresses.

For more information on RTC see https://cloud.google.com/deployment-manager/runtime-configurator/reference/rest/

It is assumed that this is being curated, and indeed can be controlled with settings in a cloudprober configuration. See cloudprober/config/config.proto.

func (*TargetsConf) Descriptor

func (*TargetsConf) Descriptor() ([]byte, []int)

func (*TargetsConf) GetCfg

func (m *TargetsConf) GetCfg() string

func (*TargetsConf) GetExpireMsec

func (m *TargetsConf) GetExpireMsec() int32

func (*TargetsConf) GetGroups

func (m *TargetsConf) GetGroups() []string

func (*TargetsConf) GetReEvalSec

func (m *TargetsConf) GetReEvalSec() int32

func (*TargetsConf) GetResolveTag

func (m *TargetsConf) GetResolveTag() string

func (*TargetsConf) ProtoMessage

func (*TargetsConf) ProtoMessage()

func (*TargetsConf) Reset

func (m *TargetsConf) Reset()

func (*TargetsConf) String

func (m *TargetsConf) String() string

Directories

Path Synopsis
Package rtcreporter implements a reporting mechanism for RTC targets.
Package rtcreporter implements a reporting mechanism for RTC targets.
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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL