setup

package
v0.15.0-rc.5 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package setup contains common logic for setting up the export package across binaries.

Index

Constants

View Source
const (
	// Supported HA backend modes.
	HABackendNone       = "none"
	HABackendKubernetes = "kube"
	// User agent environments.
	UAEnvGKE         = "gke"
	UAEnvGCE         = "gce"
	UAEnvUnspecified = "unspecified"

	// User agent modes.
	UAModeGKE         = "gke"
	UAModeKubectl     = "kubectl"
	UAModeUnspecified = "unspecified"
	UAModeAVMW        = "on-prem"
	UAModeABM         = "baremetal"
)
View Source
const ExtraArgsEnvvar = "EXTRA_ARGS"

Environment variable that contains additional command line arguments. It can be used to inject additional arguments when the regular ones cannot be easily modified.

Variables

View Source
var ErrLocationGlobal = errors.New("Location must be set to a named Google Cloud " +
	"region and cannot be set to \"global\". Please choose the " +
	"Google Cloud region that is physically nearest to your cluster. " +
	"See https://www.cloudinfrastructuremap.com/")

Functions

func ExporterOptsFlags added in v0.14.0

func ExporterOptsFlags(a *kingpin.Application, opts *export.ExporterOpts)

ExporterOptsFlags adds flags to the application, defaulting the options.

func ExtraArgs added in v0.4.1

func ExtraArgs() ([]string, error)

ExtraArgs returns additional command line arguments extracted from the EXTRA_ARGS. environment variable. It is parsed like a shell parses arguments. For example: EXTRA_ARGS="--foo=bar -x 123". It can be used like `flagset.Parse(append(os.Args[1:], ExtraArgs()...))`.

func Global

func Global() *export.Exporter

Global returns the global instance of the GCM exporter.

func SetGlobal

func SetGlobal(exporter *export.Exporter) (err error)

SetGlobal sets the global instance of the GCM exporter.

Types

type HAOptions added in v0.14.0

type HAOptions struct {
	Backend        string
	KubeConfigFile string
	KubeNamespace  string
	KubeName       string
}

func (*HAOptions) DefaultUnsetFields added in v0.14.0

func (opts *HAOptions) DefaultUnsetFields()

DefaultUnsetFields defaults any zero-valued fields.

func (*HAOptions) NewLease added in v0.14.0

func (opts *HAOptions) NewLease(logger log.Logger, reg prometheus.Registerer) (export.Lease, error)

func (*HAOptions) SetupFlags added in v0.14.0

func (opts *HAOptions) SetupFlags(a *kingpin.Application)

SetupFlags adds flags to the application, defaulting the options.

type MetadataOpts added in v0.14.0

type MetadataOpts struct {
	FetchTimeout time.Duration
}

func (*MetadataOpts) DefaultUnsetFields added in v0.14.0

func (o *MetadataOpts) DefaultUnsetFields()

DefaultUnsetFields defaults any zero-valued fields.

func (*MetadataOpts) ExtractMetadata added in v0.14.0

func (o *MetadataOpts) ExtractMetadata(logger log.Logger, exporterOpts *export.ExporterOpts)

func (*MetadataOpts) SetupFlags added in v0.14.0

func (o *MetadataOpts) SetupFlags(a *kingpin.Application)

SetupFlags adds flags to the application, defaulting the options.

type Opts added in v0.14.0

type Opts struct {
	ExporterOpts export.ExporterOpts
	MetadataOpts MetadataOpts
	HAOptions    HAOptions
}

func (*Opts) NewExporter added in v0.14.0

func (opts *Opts) NewExporter(ctx context.Context, logger log.Logger, reg prometheus.Registerer) (*export.Exporter, error)

func (*Opts) SetupFlags added in v0.14.0

func (opts *Opts) SetupFlags(a *kingpin.Application)

SetupFlags adds flags to the application, defaulting the options.

Jump to

Keyboard shortcuts

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