populator

package
v1.0.0-alpha3 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2018 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package populator is a package that will help us to populate the kubernetes config file with the right credentials

Index

Constants

View Source
const (
	// ClientSecret necessary for OpenID connect
	ClientSecret = "0c4feb1e9d11790451a4364e803284a60905cef1a5f9bf7bad5f0eeb"
	// ClientID is a client id that all tokens must be issued for.
	ClientID = "ckvyq40yyGSH"
	// IDPIssuerURL is the URL of the provider which allows the API server to discover public signing keys.
	IDPIssuerURL = "https://auth.staging.nlze.nl"
	// DirPermissions are the output directory's permissions.
	DirPermissions = 0755
)

Variables

View Source
var Prefix = "nerd-cli"

Prefix is used to know if a context comes from the cli.

Functions

func Context

func Context(filename string) bool

Context defines if the current context from the kube config file comes from the cli

func Namespace

func Namespace(filename string) (string, error)

Namespace get the namespace of the current context from the kube config file

func ReadConfig

func ReadConfig(filename string) (*api.Config, error)

ReadConfig retrieves Kubernetes client configuration from a file. If no files exists, it returns an error.

func ReadConfigOrNew

func ReadConfigOrNew(filename string) (*api.Config, error)

ReadConfigOrNew retrieves Kubernetes client configuration from a file. If no files exists, an empty configuration is returned.

func WriteConfig

func WriteConfig(config *api.Config, filename string) error

WriteConfig encodes the configuration and writes it to the given file. If the file exists, it's contents will be overwritten.

Types

type EndpointPopulator

type EndpointPopulator struct {
	// contains filtered or unexported fields
}

EndpointPopulator is an implementation of the P interface based on the retrieval of a conf file.

func (*EndpointPopulator) GetKubeConfigFile

func (e *EndpointPopulator) GetKubeConfigFile() string

GetKubeConfigFile returns the path where the kube config is stored

func (*EndpointPopulator) PopulateKubeConfig

func (e *EndpointPopulator) PopulateKubeConfig(project string) error

PopulateKubeConfig populates an api.Config object and set the current context to the provided project.

func (*EndpointPopulator) RemoveConfig

func (e *EndpointPopulator) RemoveConfig(project string) error

RemoveConfig deletes the precised project context and cluster info.

type EnvPopulator

type EnvPopulator struct {
	// contains filtered or unexported fields
}

EnvPopulator is a populator implementation based on env variables.

func (*EnvPopulator) GetKubeConfigFile

func (e *EnvPopulator) GetKubeConfigFile() string

GetKubeConfigFile returns the path where the kube config is stored.

func (*EnvPopulator) PopulateKubeConfig

func (e *EnvPopulator) PopulateKubeConfig(project string) error

PopulateKubeConfig populates the kube config file with the info found in the environment.

func (*EnvPopulator) RemoveConfig

func (e *EnvPopulator) RemoveConfig(project string) error

RemoveConfig deletes the precised project context and cluster info.

type ErrNoSuchPopulator

type ErrNoSuchPopulator string

ErrNoSuchPopulator implements the error interface

func (ErrNoSuchPopulator) Error

func (e ErrNoSuchPopulator) Error() string

type OIDCPopulator

type OIDCPopulator struct {
	// contains filtered or unexported fields
}

OIDCPopulator is an implementation of the P interface using on Open ID Connect credentials.

func (*OIDCPopulator) GetKubeConfigFile

func (o *OIDCPopulator) GetKubeConfigFile() string

GetKubeConfigFile returns the path where the kube config is stored.

func (*OIDCPopulator) PopulateKubeConfig

func (o *OIDCPopulator) PopulateKubeConfig(project string) error

PopulateKubeConfig populates an api.Config object and set the current context to the provided project.

func (*OIDCPopulator) RemoveConfig

func (o *OIDCPopulator) RemoveConfig(project string) error

RemoveConfig deletes the precised project context and cluster info.

type P

type P interface {
	PopulateKubeConfig(project string) error
	RemoveConfig(project string) error
}

P is an interface that we can use to read from and to write to the kube config file.

func New

func New(conf, kubeConfigFile, homedir string, project *v1payload.GetProjectOutput) (P, error)

New instantiates a new P interface using the conf parameter. It can return a env, endpoint or oidc populator.

Jump to

Keyboard shortcuts

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