k8stoken

package module
v0.0.0-...-cbf6fc9 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

README

k8stoken

Generate a Kubernetes client token for use anywhere!

WARNING: This is pretty hacky. This was just a fun idea I had to see if it could work. I would recommend using client-go as much as possible for k8s client code.

This proof of concept came from wanting to use the client-go libraries to get valid k8s user credentials for use with other non-rest clients (i.e. gRPC).

Currently, the client-go implementation relies heavily on http.RoundTripper to inject the user credential into requests, but this makes it difficult to only get the token to use elsewhere. Instead of trying to refactor client-go, this library simply constructs a fake http.RoundTripper and intercepts the bearer token. This means that you get all the nice token caching behavior out of the box!

Note: This only supports bearer tokens - cert based auth is not supported.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Token

func Token(config *rest.Config) (string, error)

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳