Documentation
¶
Overview ¶
Package populator is a package that will help us to populate the kubernetes config file with the right credentials
Index ¶
- Constants
- Variables
- func Context(filename string) bool
- func Namespace(filename string) (string, error)
- func ReadConfig(filename string) (*api.Config, error)
- func ReadConfigOrNew(filename string) (*api.Config, error)
- func WriteConfig(config *api.Config, filename string) error
- type Client
- type EndpointPopulator
- type EnvPopulator
- type ErrNoSuchPopulator
- type OIDCPopulator
- type P
Constants ¶
const (
// DirPermissions are the output directory's permissions.
DirPermissions = 0755
)
Variables ¶
var Prefix = "nerd-cli"
Prefix is used to know if a context comes from the cli.
Functions ¶
func ReadConfig ¶
ReadConfig retrieves Kubernetes client configuration from a file. If no files exists, it returns an error.
func ReadConfigOrNew ¶
ReadConfigOrNew retrieves Kubernetes client configuration from a file. If no files exists, an empty configuration is returned.
Types ¶
type Client ¶
type Client struct {
// Secret necessary for OpenID connect
Secret string
// ID is a client id that all tokens must be issued for.
ID string
// IDPIssuerURL is the URL of the provider which allows the API server to discover public signing keys.
IDPIssuerURL string
}
Client provides necessary information to successfully use OIDC
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.