Documentation ¶
Index ¶
- Variables
- func CreateAllowedContextMap(contexts []string) map[string]string
- func GetClusterCandidatesFromKubeconfig(kubeconfig []byte, projectID uint, local bool) ([]*models.ClusterCandidate, error)
- func GetDynamicClientOutOfClusterConfig(conf *OutOfClusterConfig) (dynamic.Interface, error)
- func GetRawConfigFromBytes(kubeconfig []byte) (*api.Config, error)
- func IsInCluster() bool
- func NewRESTClientGetterFromInClusterConfig(conf *rest.Config) genericclioptions.RESTClientGetter
- type Agent
- func (a *Agent) CreateConfigMap(name string, namespace string, configMap map[string]string) (*v1.ConfigMap, error)
- func (a *Agent) CreateImagePullSecrets(repo repository.Repository, namespace string, ...) (map[string]string, error)
- func (a *Agent) CreateLinkedSecret(name, namespace, cmName string, data map[string][]byte) (*v1.Secret, error)
- func (a *Agent) CreateNamespace(name string) (*v1.Namespace, error)
- func (a *Agent) DeleteConfigMap(name string, namespace string) error
- func (a *Agent) DeleteJob(name, namespace string) error
- func (a *Agent) DeleteLinkedSecret(name, namespace string) error
- func (a *Agent) DeleteNamespace(name string) error
- func (a *Agent) DeletePod(namespace string, name string) error
- func (a *Agent) GetConfigMap(name string, namespace string) (*v1.ConfigMap, error)
- func (a *Agent) GetCronJob(c grapher.Object) (*batchv1beta1.CronJob, error)
- func (a *Agent) GetDaemonSet(c grapher.Object) (*appsv1.DaemonSet, error)
- func (a *Agent) GetDeployment(c grapher.Object) (*appsv1.Deployment, error)
- func (a *Agent) GetIngress(namespace string, name string) (*v1beta1.Ingress, error)
- func (a *Agent) GetJob(c grapher.Object) (*batchv1.Job, error)
- func (a *Agent) GetJobPods(namespace, jobName string) ([]v1.Pod, error)
- func (a *Agent) GetPodLogs(namespace string, name string, rw *websocket.WebsocketSafeReadWriter) error
- func (a *Agent) GetPodsByLabel(selector string, namespace string) (*v1.PodList, error)
- func (a *Agent) GetReplicaSet(c grapher.Object) (*appsv1.ReplicaSet, error)
- func (a *Agent) GetSecret(name string, namespace string) (*v1.Secret, error)
- func (a *Agent) GetStatefulSet(c grapher.Object) (*appsv1.StatefulSet, error)
- func (a *Agent) ListConfigMaps(namespace string) (*v1.ConfigMapList, error)
- func (a *Agent) ListEvents(name string, namespace string) (*v1.EventList, error)
- func (a *Agent) ListJobsByLabel(namespace string, labels ...Label) ([]batchv1.Job, error)
- func (a *Agent) ListNamespaces() (*v1.NamespaceList, error)
- func (a *Agent) ProvisionDOCR(opts *SharedProvisionOpts, doConf *integrations.OAuthIntegration, ...) (*batchv1.Job, error)
- func (a *Agent) ProvisionDOKS(opts *SharedProvisionOpts, doConf *integrations.OAuthIntegration, ...) (*batchv1.Job, error)
- func (a *Agent) ProvisionECR(opts *SharedProvisionOpts, awsConf *integrations.AWSIntegration, ...) (*batchv1.Job, error)
- func (a *Agent) ProvisionEKS(opts *SharedProvisionOpts, awsConf *integrations.AWSIntegration, ...) (*batchv1.Job, error)
- func (a *Agent) ProvisionGCR(opts *SharedProvisionOpts, gcpConf *integrations.GCPIntegration) (*batchv1.Job, error)
- func (a *Agent) ProvisionGKE(opts *SharedProvisionOpts, gcpConf *integrations.GCPIntegration, ...) (*batchv1.Job, error)
- func (a *Agent) ProvisionTest(opts *SharedProvisionOpts) (*batchv1.Job, error)
- func (a *Agent) RunWebsocketTask(task func() error) error
- func (a *Agent) StopJobWithJobSidecar(namespace, name string) error
- func (a *Agent) StreamControllerStatus(kind string, selectors string, rw *websocket.WebsocketSafeReadWriter) error
- func (a *Agent) StreamHelmReleases(namespace string, chartList []string, selectors string, ...) error
- func (a *Agent) UpdateClientset() error
- func (a *Agent) UpdateConfigMap(name string, namespace string, configMap map[string]string) (*v1.ConfigMap, error)
- func (a *Agent) UpdateLinkedSecret(name, namespace, cmName string, data map[string][]byte) error
- type AuthError
- type BadRequestError
- type ErrConnection
- type ErrExternalized
- type ErrUnauthorized
- type ErrUnknown
- type K8sConnectionError
- type Label
- type ListOptions
- type Message
- type OutOfClusterConfig
- func (conf *OutOfClusterConfig) CreateRawConfigFromCluster() (*api.Config, error)
- func (conf *OutOfClusterConfig) GetClientConfigFromCluster() (clientcmd.ClientConfig, error)
- 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 SharedProvisionOpts
Constants ¶
This section is empty.
Variables ¶
var IsNotFoundError = fmt.Errorf("not found")
Functions ¶
func CreateAllowedContextMap ¶
CreateAllowedContextMap creates a dummy map from context name to context name
func GetClusterCandidatesFromKubeconfig ¶
func GetClusterCandidatesFromKubeconfig( kubeconfig []byte, projectID uint, local bool, ) ([]*models.ClusterCandidate, error)
GetClusterCandidatesFromKubeconfig parses a kubeconfig for a list of cluster candidates.
The local boolean represents whether the auth mechanism should be designated as "local": if so, the auth mechanism uses local plugins/mechanisms purely from the kubeconfig.
func GetDynamicClientOutOfClusterConfig ¶
func GetDynamicClientOutOfClusterConfig(conf *OutOfClusterConfig) (dynamic.Interface, error)
GetDynamicClientOutOfClusterConfig creates a new dynamic client using the OutOfClusterConfig
func GetRawConfigFromBytes ¶
GetRawConfigFromBytes returns the clientcmdapi.Config from kubeconfig bytes
func IsInCluster ¶ added in v0.3.1
func IsInCluster() bool
IsInCluster returns true if the process is running in a Kubernetes cluster, false otherwise
func NewRESTClientGetterFromInClusterConfig ¶ added in v0.5.0
func NewRESTClientGetterFromInClusterConfig(conf *rest.Config) genericclioptions.RESTClientGetter
NewRESTClientGetterFromInClusterConfig returns a RESTClientGetter using default values set from the *rest.Config
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) CreateConfigMap ¶
func (a *Agent) CreateConfigMap(name string, namespace string, configMap map[string]string) (*v1.ConfigMap, error)
CreateConfigMap creates the configmap given the key-value pairs and namespace
func (*Agent) CreateImagePullSecrets ¶
func (a *Agent) CreateImagePullSecrets( repo repository.Repository, namespace string, linkedRegs map[string]*models.Registry, doAuth *oauth2.Config, ) (map[string]string, error)
CreateImagePullSecrets will create the required image pull secrets and return a map from the registry name to the name of the secret.
func (*Agent) CreateLinkedSecret ¶
func (a *Agent) CreateLinkedSecret(name, namespace, cmName string, data map[string][]byte) (*v1.Secret, error)
CreateLinkedSecret creates a secret given the key-value pairs and namespace. Values are base64 encoded
func (*Agent) CreateNamespace ¶ added in v0.3.2
CreateNamespace creates a namespace with the given name.
func (*Agent) DeleteConfigMap ¶
DeleteConfigMap deletes the configmap given its name and namespace
func (*Agent) DeleteJob ¶ added in v0.3.4
DeleteJob deletes the job in the given name and namespace.
func (*Agent) DeleteLinkedSecret ¶
DeleteLinkedSecret deletes the secret given its name and namespace
func (*Agent) DeleteNamespace ¶ added in v0.3.2
DeleteNamespace deletes the namespace given the name.
func (*Agent) GetConfigMap ¶
GetConfigMap retrieves the configmap given its name and namespace
func (*Agent) GetCronJob ¶
GetCronJob gets the CronJob by name and namespace
func (*Agent) GetDaemonSet ¶
GetDaemonSet gets the daemonset by name and namespace
func (*Agent) GetDeployment ¶
GetDeployment gets the deployment given the name and namespace
func (*Agent) GetIngress ¶
GetIngress gets ingress given the name and namespace
func (*Agent) GetJobPods ¶
GetJobPods lists all pods belonging to a job in a namespace
func (*Agent) GetPodLogs ¶
func (a *Agent) GetPodLogs(namespace string, name string, rw *websocket.WebsocketSafeReadWriter) error
GetPodLogs streams real-time logs from a given pod.
func (*Agent) GetPodsByLabel ¶
GetPodsByLabel retrieves pods with matching labels
func (*Agent) GetReplicaSet ¶
GetReplicaSet gets the replicaset given the name and namespace
func (*Agent) GetSecret ¶ added in v0.7.2
GetSecret retrieves the secret given its name and namespace
func (*Agent) GetStatefulSet ¶
GetStatefulSet gets the statefulset given the name and namespace
func (*Agent) ListConfigMaps ¶
func (a *Agent) ListConfigMaps(namespace string) (*v1.ConfigMapList, error)
ListConfigMaps simply lists namespaces
func (*Agent) ListEvents ¶ added in v0.3.0
ListEvents lists the events of a given object.
func (*Agent) ListJobsByLabel ¶
func (*Agent) ListNamespaces ¶
func (a *Agent) ListNamespaces() (*v1.NamespaceList, error)
ListNamespaces simply lists namespaces
func (*Agent) ProvisionDOCR ¶
func (a *Agent) ProvisionDOCR( opts *SharedProvisionOpts, doConf *integrations.OAuthIntegration, doAuth *oauth2.Config, docrName, docrSubscriptionTier string, ) (*batchv1.Job, error)
ProvisionDOCR spawns a new provisioning pod that creates a DOCR instance
func (*Agent) ProvisionDOKS ¶
func (a *Agent) ProvisionDOKS( opts *SharedProvisionOpts, doConf *integrations.OAuthIntegration, doAuth *oauth2.Config, doRegion, doksClusterName string, ) (*batchv1.Job, error)
ProvisionDOKS spawns a new provisioning pod that creates a DOKS instance
func (*Agent) ProvisionECR ¶
func (a *Agent) ProvisionECR( opts *SharedProvisionOpts, awsConf *integrations.AWSIntegration, ecrName string, ) (*batchv1.Job, error)
ProvisionECR spawns a new provisioning pod that creates an ECR instance
func (*Agent) ProvisionEKS ¶
func (a *Agent) ProvisionEKS( opts *SharedProvisionOpts, awsConf *integrations.AWSIntegration, eksName, machineType string, ) (*batchv1.Job, error)
ProvisionEKS spawns a new provisioning pod that creates an EKS instance
func (*Agent) ProvisionGCR ¶
func (a *Agent) ProvisionGCR( opts *SharedProvisionOpts, gcpConf *integrations.GCPIntegration, ) (*batchv1.Job, error)
ProvisionGCR spawns a new provisioning pod that creates a GCR instance
func (*Agent) ProvisionGKE ¶
func (a *Agent) ProvisionGKE( opts *SharedProvisionOpts, gcpConf *integrations.GCPIntegration, gkeName string, ) (*batchv1.Job, error)
ProvisionGKE spawns a new provisioning pod that creates a GKE instance
func (*Agent) ProvisionTest ¶
func (a *Agent) ProvisionTest( opts *SharedProvisionOpts, ) (*batchv1.Job, error)
ProvisionTest spawns a new provisioning pod that tests provisioning
func (*Agent) RunWebsocketTask ¶ added in v0.10.0
RunWebsocketTask will run a websocket task. If the websocket returns an anauthorized error, it will restart the task some number of times until failing
func (*Agent) StopJobWithJobSidecar ¶ added in v0.3.0
StopJobWithJobSidecar sends a termination signal to a job running with a sidecar
func (*Agent) StreamControllerStatus ¶
func (a *Agent) StreamControllerStatus(kind string, selectors string, rw *websocket.WebsocketSafeReadWriter) error
StreamControllerStatus streams controller status. Supports Deployment, StatefulSet, ReplicaSet, and DaemonSet TODO: Support Jobs
func (*Agent) StreamHelmReleases ¶ added in v0.4.4
func (*Agent) UpdateClientset ¶ added in v0.10.0
UpdateClientset updates the Agent's Clientset (this refreshes auth tokens)
type BadRequestError ¶ added in v0.10.2
type BadRequestError struct {
// contains filtered or unexported fields
}
func (*BadRequestError) Error ¶ added in v0.10.2
func (e *BadRequestError) Error() string
type ErrConnection ¶ added in v0.3.2
type ErrConnection struct {
// contains filtered or unexported fields
}
For ECONNREFUSED and errors.IsTimeout
func (*ErrConnection) Error ¶ added in v0.3.2
func (e *ErrConnection) Error() string
func (*ErrConnection) Externalize ¶ added in v0.3.2
func (e *ErrConnection) Externalize() *ErrExternalized
type ErrExternalized ¶ added in v0.3.2
type ErrUnauthorized ¶ added in v0.3.2
type ErrUnauthorized struct {
// contains filtered or unexported fields
}
For errors.IsForbidden and errors.IsUnauthorized
func (*ErrUnauthorized) Error ¶ added in v0.3.2
func (e *ErrUnauthorized) Error() string
func (*ErrUnauthorized) Externalize ¶ added in v0.3.2
func (e *ErrUnauthorized) Externalize() *ErrExternalized
type ErrUnknown ¶ added in v0.3.2
type ErrUnknown struct {
// contains filtered or unexported fields
}
func (*ErrUnknown) Error ¶ added in v0.3.2
func (e *ErrUnknown) Error() string
func (*ErrUnknown) Externalize ¶ added in v0.3.2
func (e *ErrUnknown) Externalize() *ErrExternalized
type K8sConnectionError ¶ added in v0.3.2
type K8sConnectionError interface { Externalize() *ErrExternalized Error() string }
func CatchK8sConnectionError ¶ added in v0.3.2
func CatchK8sConnectionError(err error) K8sConnectionError
type ListOptions ¶
type ListOptions struct {
FieldSelector string
}
type OutOfClusterConfig ¶
type OutOfClusterConfig struct { Cluster *models.Cluster Repo repository.Repository DefaultNamespace string // optional // Only required if using DigitalOcean OAuth as an auth mechanism DigitalOceanOAuth *oauth2.Config }
OutOfClusterConfig is the set of parameters required for an out-of-cluster connection. This implements RESTClientGetter
func (*OutOfClusterConfig) CreateRawConfigFromCluster ¶
func (conf *OutOfClusterConfig) CreateRawConfigFromCluster() (*api.Config, error)
func (*OutOfClusterConfig) GetClientConfigFromCluster ¶
func (conf *OutOfClusterConfig) GetClientConfigFromCluster() (clientcmd.ClientConfig, error)
GetClientConfigFromCluster will construct new clientcmd.ClientConfig using the configuration saved within a Cluster model
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.
type SharedProvisionOpts ¶ added in v0.10.0
type SharedProvisionOpts struct {}