kubernetes

package
v0.1.0-beta.3 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2021 License: MIT Imports: 42 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateAllowedContextMap

func CreateAllowedContextMap(contexts []string) map[string]string

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

func GetRawConfigFromBytes(kubeconfig []byte) (*api.Config, error)

GetRawConfigFromBytes returns the clientcmdapi.Config from kubeconfig bytes

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

func GetAgentInClusterConfig() (*Agent, error)

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

func GetAgentTesting(objects ...runtime.Object) *Agent

GetAgentTesting creates a new Agent using an optional existing storage class

func (*Agent) GetDaemonSet

func (a *Agent) GetDaemonSet(c grapher.Object) (*appsv1.DaemonSet, error)

GetDaemonSet gets the daemonset by name and namespace

func (*Agent) GetDeployment

func (a *Agent) GetDeployment(c grapher.Object) (*appsv1.Deployment, error)

GetDeployment gets the deployment given the name and namespace

func (*Agent) GetIngress

func (a *Agent) GetIngress(namespace string, name string) (*v1beta1.Ingress, error)

GetIngress gets ingress given the name and namespace

func (*Agent) GetPodLogs

func (a *Agent) GetPodLogs(namespace string, name string, conn *websocket.Conn) error

GetPodLogs streams real-time logs from a given pod.

func (*Agent) GetPodsByLabel

func (a *Agent) GetPodsByLabel(selector string) (*v1.PodList, error)

GetPodsByLabel retrieves pods with matching labels

func (*Agent) GetReplicaSet

func (a *Agent) GetReplicaSet(c grapher.Object) (*appsv1.ReplicaSet, error)

GetReplicaSet gets the replicaset given the name and namespace

func (*Agent) GetStatefulSet

func (a *Agent) GetStatefulSet(c grapher.Object) (*appsv1.StatefulSet, error)

GetStatefulSet gets the statefulset given the name and namespace

func (*Agent) ListNamespaces

func (a *Agent) ListNamespaces() (*v1.NamespaceList, error)

ListNamespaces simply lists namespaces

func (*Agent) ProvisionECR

func (a *Agent) ProvisionECR(
	projectID uint,
	awsConf *integrations.AWSIntegration,
	ecrName string,
	awsInfra *models.AWSInfra,
	operation provisioner.ProvisionerOperation,
	pgConf *config.DBConf,
	redisConf *config.RedisConf,
) (*batchv1.Job, error)

ProvisionECR spawns a new provisioning pod that creates an ECR instance

func (*Agent) ProvisionEKS

func (a *Agent) ProvisionEKS(
	projectID uint,
	awsConf *integrations.AWSIntegration,
	eksName string,
	awsInfra *models.AWSInfra,
	operation provisioner.ProvisionerOperation,
	pgConf *config.DBConf,
	redisConf *config.RedisConf,
) (*batchv1.Job, error)

ProvisionEKS spawns a new provisioning pod that creates an EKS instance

func (*Agent) ProvisionTest

func (a *Agent) ProvisionTest(
	projectID uint,
	operation provisioner.ProvisionerOperation,
	pgConf *config.DBConf,
	redisConf *config.RedisConf,
) (*batchv1.Job, error)

ProvisionTest spawns a new provisioning pod that tests provisioning

func (*Agent) StreamControllerStatus

func (a *Agent) StreamControllerStatus(conn *websocket.Conn, kind string) error

StreamControllerStatus streams controller status. Supports Deployment, StatefulSet, ReplicaSet, and DaemonSet TODO: Support Jobs

type ListOptions

type ListOptions struct {
	FieldSelector string
}

type Message

type Message struct {
	EventType string
	Object    interface{}
	Kind      string
}

type OutOfClusterConfig

type OutOfClusterConfig struct {
	Cluster *models.Cluster
	Repo    *repository.Repository
}

OutOfClusterConfig is the set of parameters required for an out-of-cluster connection. This implements RESTClientGetter

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.

Directories

Path Synopsis
aws

Jump to

Keyboard shortcuts

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