Documentation
¶
Overview ¶
Package populator is a package that will help us to populate the kubernetes config file with the right credentials
Index ¶
- Constants
- func Namespace(filename string) (string, error)
- func NerdContext(filename string) bool
- func ReadConfig(filename string) (*api.Config, error)
- func ReadConfigOrNew(filename string) (*api.Config, error)
- func UseConfig(context string, filename string) error
- func WriteConfig(config *api.Config, filename string) error
- type Auth
- type Client
- type Cluster
- type Context
- type EndpointPopulator
- type EnvPopulator
- type ErrNoSuchPopulator
- type GenericPopulator
- type P
Constants ¶
const ( // DirPermissions are the output directory's permissions. DirPermissions = 0755 //Prefix is used to know if a context comes from the cli. Prefix = "nerdalize" )
Variables ¶
This section is empty.
Functions ¶
func NerdContext ¶
NerdContext defines if the current context from the kube config file comes from the cli
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 Auth ¶
type Auth struct {
User string `long:"user" description:"user to use for this configuration"`
Password string `long:"password" description:"password for the user entry in kubeconfig"`
Token string `long:"token" description:"token for the user entry in kubeconfig"`
Username string `long:"username" description:"username for the user entry in kubeconfig"`
AuthProvider string `long:"auth-provider" description:""`
AuthProviderArgs []string `long:"auth-provider-arg" description:"key=value"`
ClientCertificate string `long:"client-certificate" description:"Path to client-certificate file for the user entry in kubeconfig"`
ClientKey string `long:"client-key" description:"Path to client-key file for the user entry in kubeconfig"`
EmbedCerts string `long:"embed-certs" description:"Embed client cert/key for the user entry in kubeconfig"`
SecureClientSecret string `long:"secure-client-secret" description:"mandatory to setup OIDC"`
SecureClientID string `long:"secure-client-id" description:"mandatory to setup OIDC"`
IDPIssuerURL string `long:"idp-issuer-url" description:"mandatory to setup OIDC"`
IDPCaPath string `long:"idp-ca-path" description:"path to your ca certificate"`
RefreshToken string `long:"refresh-token" description:"mandatory to setup OIDC"`
IDToken string `long:"id-token" description:"mandatory to setup OIDC"`
}
Auth information
type Client ¶
type Client struct {
// TODO CLEANING
// 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 Cluster ¶
type Cluster struct {
Name string `long:"cluster" description:"name of the cluster configuration entry"`
Server string `long:"server" short:"s" description:"url of the cluster to reach"`
CA string `long:"certificate-authority" description:""`
CAPath string `long:"certificate-authority-path" description:""`
}
Cluster information
type Context ¶
type Context struct {
Name string `long:"context" description:"context to use for this configuration"`
Namespace string `long:"context-ns" description:"" default:"default"`
Server string `long:"context-server" description:"if not provided, will use the cluster name"`
User string `long:"context-user" description:" If not provided, will use the info from the next options"`
}
Context information
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 GenericPopulator ¶
type GenericPopulator struct {
// contains filtered or unexported fields
}
GenericPopulator is an implementation of the P interface using on Open ID Connect credentials.
func (*GenericPopulator) GetKubeConfigFile ¶
func (o *GenericPopulator) GetKubeConfigFile() string
GetKubeConfigFile returns the path where the kube config is stored.
func (*GenericPopulator) PopulateKubeConfig ¶
func (o *GenericPopulator) PopulateKubeConfig(namespace string) error
PopulateKubeConfig populates an api.Config object and set the current context to the provided cluster.
func (*GenericPopulator) RemoveConfig ¶
func (o *GenericPopulator) RemoveConfig(cluster string) error
RemoveConfig deletes the precised cluster context and cluster info.