Documentation ¶
Index ¶
- func CreateAllowedContextMap(contexts []string) map[string]string
- func GetClientConfigFromServiceAccount(sa *models.ServiceAccount, clusterID uint, ...) (clientcmd.ClientConfig, error)
- func GetContextsFromBytes(bytes []byte, allowedContexts []string) ([]models.Context, error)
- func GetRawConfigFromBytes(kubeconfig []byte) (*api.Config, error)
- func GetRestrictedClientConfigFromBytes(bytes []byte, contextName string, allowedContexts []string) (clientcmd.ClientConfig, error)
- func GetServiceAccountCandidates(kubeconfig []byte) ([]*models.ServiceAccountCandidate, error)
- type Agent
- type OutOfClusterConfig
- func (conf *OutOfClusterConfig) ToDiscoveryClient() (discovery.CachedDiscoveryInterface, error)
- func (conf *OutOfClusterConfig) ToRESTConfig() (*rest.Config, error)
- func (conf *OutOfClusterConfig) ToRESTMapper() (meta.RESTMapper, error)
- func (conf *OutOfClusterConfig) ToRawKubeConfigLoader() clientcmd.ClientConfig
- type UpdateTokenCacheFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateAllowedContextMap ¶
CreateAllowedContextMap creates a dummy map from context name to context name
func GetClientConfigFromServiceAccount ¶
func GetClientConfigFromServiceAccount( sa *models.ServiceAccount, clusterID uint, updateTokenCache UpdateTokenCacheFunc, ) (clientcmd.ClientConfig, error)
GetClientConfigFromServiceAccount will construct new clientcmd.ClientConfig using the configuration saved within a ServiceAccount model
func GetContextsFromBytes ¶
GetContextsFromBytes converts a raw string to a set of Contexts by unmarshaling and calling toContexts
func GetRawConfigFromBytes ¶
GetRawConfigFromBytes returns the clientcmdapi.Config from kubeconfig bytes
func GetRestrictedClientConfigFromBytes ¶
func GetRestrictedClientConfigFromBytes( bytes []byte, contextName string, allowedContexts []string, ) (clientcmd.ClientConfig, error)
GetRestrictedClientConfigFromBytes returns a clientcmd.ClientConfig from a raw kubeconfig, a context name, and the set of allowed contexts.
func GetServiceAccountCandidates ¶
func GetServiceAccountCandidates(kubeconfig []byte) ([]*models.ServiceAccountCandidate, error)
GetServiceAccountCandidates parses a kubeconfig for a list of service account candidates.
Types ¶
type Agent ¶
type Agent struct { RESTClientGetter genericclioptions.RESTClientGetter Clientset kubernetes.Interface }
Agent is a Kubernetes agent for performing operations that interact with the api server
func GetAgentInClusterConfig ¶
GetAgentInClusterConfig uses the service account that kubernetes gives to pods to connect
func GetAgentOutOfClusterConfig ¶
func GetAgentOutOfClusterConfig(conf *OutOfClusterConfig) (*Agent, error)
GetAgentOutOfClusterConfig creates a new Agent using the OutOfClusterConfig
func GetAgentTesting ¶
GetAgentTesting creates a new Agent using an optional existing storage class
func (*Agent) GetPodLogs ¶
GetPodLogs streams real-time logs from a given pod.
func (*Agent) GetPodsByLabel ¶
GetPodsByLabel retrieves pods with matching labels
func (*Agent) ListNamespaces ¶
func (a *Agent) ListNamespaces() (*v1.NamespaceList, error)
ListNamespaces simply lists namespaces
type OutOfClusterConfig ¶
type OutOfClusterConfig struct { ServiceAccount *models.ServiceAccount `form:"required"` ClusterID uint `json:"cluster_id" form:"required"` UpdateTokenCache UpdateTokenCacheFunc }
OutOfClusterConfig is the set of parameters required for an out-of-cluster connection. This implements RESTClientGetter
func (*OutOfClusterConfig) ToDiscoveryClient ¶
func (conf *OutOfClusterConfig) ToDiscoveryClient() (discovery.CachedDiscoveryInterface, error)
ToDiscoveryClient returns a CachedDiscoveryInterface using a computed RESTConfig It's required to implement the interface genericclioptions.RESTClientGetter
func (*OutOfClusterConfig) ToRESTConfig ¶
func (conf *OutOfClusterConfig) ToRESTConfig() (*rest.Config, error)
ToRESTConfig creates a kubernetes REST client factory -- it calls ClientConfig on the result of ToRawKubeConfigLoader, and also adds a custom http transport layer if necessary (required for GCP auth)
func (*OutOfClusterConfig) ToRESTMapper ¶
func (conf *OutOfClusterConfig) ToRESTMapper() (meta.RESTMapper, error)
ToRESTMapper returns a mapper
func (*OutOfClusterConfig) ToRawKubeConfigLoader ¶
func (conf *OutOfClusterConfig) ToRawKubeConfigLoader() clientcmd.ClientConfig
ToRawKubeConfigLoader creates a clientcmd.ClientConfig from the raw kubeconfig found in the OutOfClusterConfig. It does not implement loading rules or overrides.