k8sresolver

package
v1.0.0-beta.test.7 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2017 License: Apache-2.0 Imports: 16 Imported by: 0

README

k8sresolver

Kubernetes resolver based on endpoint API

Inspired by https://github.com/sercand/kuberesolver but more suitable for our needs.

Features:

  • K8s resolver that watches endpoint API
  • Different types of auth for kube-apiserver access. (You can run it easily from your local machine as well!)
  • URL in common kube-DNS format: <service>.<namespace>(|.<any suffix>):<port|port name>

Still todo:

  • Metrics
  • Fallback to SRV (?)

Usage

resolver, err := k8sresolver.NewFromFlags(nil)
if err != nil {
    // handle err.
}

watcher, err := resolver.Resolve(target)
if err != nil {
    // handle err.
}

// Wait for next updates.
updates, err := watcher.Next()
if err != nil {
    // handle err.
}

Documentation

Index

Constants

View Source
const (
	// ExpectedTargetFmt is an expected format of the targetEntry Name given to Resolver. This is complainant with
	// the kubeDNS/CoreDNS entry format.
	ExpectedTargetFmt = "<service>(|.<namespace>)(|.<whatever suffix>)(|:<port_name>|:<value number>)"
)

Variables

This section is empty.

Functions

func NewFromConfig

func NewFromConfig(conf *pb.K8SResolver) (target string, name naming.Resolver, err error)

func NewWithClient

func NewWithClient(apiClient *k8s.APIClient) naming.Resolver

NewWithClient returns a new Kubernetes resolver using given k8s.APIClient configured to be used against kube-apiserver.

Types

This section is empty.

Jump to

Keyboard shortcuts

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