rest

package
v0.27.2 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

This package contains some of the in-cluster configuration logic from config.go to avoid a dependency on k8s.io/client-go. Only code used in Pomerium is included, and some usages of helper functions/types have been refactored out.

Index

Constants

This section is empty.

Variables

View Source
var ErrNotInCluster = errors.New("unable to load in-cluster configuration, KUBERNETES_SERVICE_HOST and KUBERNETES_SERVICE_PORT must be defined")

Functions

This section is empty.

Types

type Config

type Config struct {
	// Host must be a host string, a host:port pair, or a URL to the base of the apiserver.
	// If a URL is given then the (optional) Path of that URL represents a prefix that must
	// be appended to all request URIs used to access the apiserver. This allows a frontend
	// proxy to easily relocate all of the apiserver endpoints.
	Host string
	// TLSClientConfig contains settings to enable transport layer security
	TLSClientConfig *tls.Config
	// Server requires Bearer authentication. This client will not attempt to use
	// refresh tokens for an OAuth2 flow.
	BearerToken string
}

Config holds the common attributes that can be passed to a Kubernetes client on initialization.

func InClusterConfig

func InClusterConfig() (*Config, error)

InClusterConfig returns a config object which uses the service account kubernetes gives to pods. It's intended for clients that expect to be running inside a pod running on kubernetes. It will return ErrNotInCluster if called from a process not running in a kubernetes environment.

Jump to

Keyboard shortcuts

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