go-discover-kubernetes

module
v0.0.0-...-0ec3f97 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2018 License: MPL-2.0

README

Go Discover Nodes for Cloud Providers Build Status GoDoc

go-discover is a Go (golang) library and command line tool to discover ip addresses of nodes in cloud environments based on meta information like tags provided by the environment.

See go-discover for full details.

This library is an extension to go-discover to add Kubernetes support, specifically to discover addresses of load-balanced applications from its related Service object.

Supported Providers

Additional cloud providers herein include:

Config Example
# Kubernetes
provider=kubernetes namespace=mynamespace label_key=role label_value=consul

Command Line Tool Usage

Install the command line tool with:

go get -u github.com/continuul/go-discover/cmd/discover

The build it with:

make build

Then run it with:

$ kubectl create -f nginx.yaml
$ kubectl create -f discover.yaml

Library Usage

Install the library with:

go get -u github.com/continuul/go-discover

You can then either support discovery for all available providers or only for some of them.

// support discovery for all supported providers
d := discover.Discover{}

// support discovery for AWS and GCE only
d := discover.Discover{
	Providers : map[string]discover.Provider{
		"aws": discover.Providers["aws"],
		"gce": discover.Providers["gce"],
		"kubernetes": &kubernetes.Provider{},
	}
}

// use ioutil.Discard for no log output
l := log.New(os.Stderr, "", log.LstdFlags)

cfg := "provider=kubernetes namespace=default ..."
addrs, err := d.Addrs(cfg, l)

Directories

Path Synopsis
provider

Jump to

Keyboard shortcuts

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