kubernetes

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2018 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Overview

Package kubernetes provides functions to trace k8s.io/client-go (https://github.com/kubernetes/client-go).

Example
package main

import (
	"fmt"

	kubernetestrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/k8s.io/client-go/kubernetes"
	meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/client-go/kubernetes"
	"k8s.io/client-go/rest"

	_ "k8s.io/client-go/plugin/pkg/client/auth/oidc"
)

func main() {
	cfg, err := rest.InClusterConfig()
	if err != nil {
		panic(err.Error())
	}
	// Use this to trace all calls made to the Kubernetes API
	cfg.WrapTransport = kubernetestrace.WrapRoundTripper

	client, err := kubernetes.NewForConfig(cfg)
	if err != nil {
		panic(err.Error())
	}

	pods, err := client.CoreV1().Pods("default").List(meta_v1.ListOptions{})
	if err != nil {
		panic(err)
	}

	fmt.Println(pods.Items)
}
Output:

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func WrapRoundTripper

func WrapRoundTripper(rt http.RoundTripper) http.RoundTripper

WrapRoundTripper wraps a RoundTripper intended for interfacing with Kubernetes and traces all requests.

Types

This section is empty.

Jump to

Keyboard shortcuts

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