kubernetes

package
v0.0.0-...-ef83997 Latest Latest
Warning

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

Go to latest
Published: May 2, 2018 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseURLProvider

type BaseURLProvider interface {
	GetAPIURL() (*string, error)
	GetMetricsURL(envNS string) (*string, error)
	GetConsoleURL(envNS string) (*string, error)
	GetLoggingURL(envNS string, deploymentName string) (*string, error)

	GetAPIToken() (*string, error)
	GetMetricsToken(envNS string) (*string, error)
}

BaseURLProvider provides the BASE URL (minimal path) of several APIs used in Deployments. For true multicluster support, every API in this inteface should take an environment namespace name. This hasn't been done, because the rest of fabric8 seems to assume the cluster is the same. For most uses, the proxy server will hide this issue - but not for metrics/logging and console.

type HawkularGetter

type HawkularGetter interface {
	GetHawkularRESTAPI(config *MetricsClientConfig) (HawkularRESTAPI, error)
}

HawkularGetter has a method to access the HawkularRESTAPI interface

type HawkularRESTAPI

type HawkularRESTAPI interface {
	ReadBuckets(metricType hawkular.MetricType, namespace string,
		modifiers ...hawkular.Modifier) ([]*hawkular.Bucketpoint, error)
	Close()
}

HawkularRESTAPI collects methods that call out to the Hawkular metrics server over the network

type KubeClientConfig

type KubeClientConfig struct {
	// Provides URLS for all APIs, and also access tokens
	BaseURLProvider
	// Kubernetes namespace in the cluster of type 'user'
	UserNamespace string
	// Timeout used for communicating with Kubernetes and OpenShift API servers,
	// a value of zero indicates no timeout
	Timeout time.Duration
	// Specifies a non-default HTTP transport to use when sending requests to
	// Kubernetes and OpenShift API servers
	Transport http.RoundTripper
	// Provides access to the Kubernetes REST API, uses default implementation if not set
	KubeRESTAPIGetter
	// Provides access to the metrics API, uses default implementation if not set
	MetricsGetter
	// Provides access to the OpenShift REST API, uses default implementation if not set
	OpenShiftRESTAPIGetter
}

KubeClientConfig holds configuration data needed to create a new KubeClientInterface with kubernetes.NewKubeClient

type KubeClientInterface

type KubeClientInterface interface {
	GetSpace(spaceName string) (*app.SimpleSpace, error)
	GetApplication(spaceName string, appName string) (*app.SimpleApp, error)
	GetDeployment(spaceName string, appName string, envName string) (*app.SimpleDeployment, error)
	ScaleDeployment(spaceName string, appName string, envName string, deployNumber int) (*int, error)
	GetDeploymentStats(spaceName string, appName string, envName string,
		startTime time.Time) (*app.SimpleDeploymentStats, error)
	GetDeploymentStatSeries(spaceName string, appName string, envName string, startTime time.Time,
		endTime time.Time, limit int) (*app.SimpleDeploymentStatSeries, error)
	DeleteDeployment(spaceName string, appName string, envName string) error
	GetEnvironments() ([]*app.SimpleEnvironment, error)
	GetEnvironment(envName string) (*app.SimpleEnvironment, error)
	GetMetricsClient(envNS string) (Metrics, error)
	Close()
}

KubeClientInterface contains configuration and methods for interacting with a Kubernetes cluster

func NewKubeClient

func NewKubeClient(config *KubeClientConfig) (KubeClientInterface, error)

NewKubeClient creates a KubeClientInterface given a configuration. The returned KubeClientInterface must be closed using the Close method, when no longer needed.

type KubeRESTAPI

type KubeRESTAPI interface {
	corev1.CoreV1Interface
}

KubeRESTAPI collects methods that call out to the Kubernetes API server over the network

type KubeRESTAPIGetter

type KubeRESTAPIGetter interface {
	GetKubeRESTAPI(config *KubeClientConfig) (KubeRESTAPI, error)
}

KubeRESTAPIGetter has a method to access the KubeRESTAPI interface

type Metrics

type Metrics interface {
	GetCPUMetrics(pods []*v1.Pod, namespace string, startTime time.Time) (*app.TimedNumberTuple, error)
	GetCPUMetricsRange(pods []*v1.Pod, namespace string, startTime time.Time, endTime time.Time,
		limit int) ([]*app.TimedNumberTuple, error)
	GetMemoryMetrics(pods []*v1.Pod, namespace string, startTime time.Time) (*app.TimedNumberTuple, error)
	GetMemoryMetricsRange(pods []*v1.Pod, namespace string, startTime time.Time, endTime time.Time,
		limit int) ([]*app.TimedNumberTuple, error)
	GetNetworkSentMetrics(pods []*v1.Pod, namespace string, startTime time.Time) (*app.TimedNumberTuple, error)
	GetNetworkSentMetricsRange(pods []*v1.Pod, namespace string, startTime time.Time, endTime time.Time,
		limit int) ([]*app.TimedNumberTuple, error)
	GetNetworkRecvMetrics(pods []*v1.Pod, namespace string, startTime time.Time) (*app.TimedNumberTuple, error)
	GetNetworkRecvMetricsRange(pods []*v1.Pod, namespace string, startTime time.Time, endTime time.Time,
		limit int) ([]*app.TimedNumberTuple, error)
	Close()
}

Metrics provides methods to obtain performance metrics of a deployed application

func NewMetricsClient

func NewMetricsClient(config *MetricsClientConfig) (Metrics, error)

NewMetricsClient creates a Metrics object given a configuration

type MetricsClientConfig

type MetricsClientConfig struct {
	// URL to the Kubernetes cluster's metrics server
	MetricsURL string
	// An authorized token to access the cluster
	BearerToken string
	// Provides access to the underlying Hawkular API, uses default implementation if not set
	HawkularGetter
}

MetricsClientConfig holds configuration data needed to create a new MetricsInterface with kubernetes.NewMetricsClient

type MetricsGetter

type MetricsGetter interface {
	GetMetrics(config *MetricsClientConfig) (Metrics, error)
}

MetricsGetter has a method to access the Metrics interface

type OpenShiftRESTAPI

type OpenShiftRESTAPI interface {
	GetBuildConfigs(namespace string, labelSelector string) (map[string]interface{}, error)
	GetBuilds(namespace string, labelSelector string) (map[string]interface{}, error)
	GetDeploymentConfig(namespace string, name string) (map[string]interface{}, error)
	DeleteDeploymentConfig(namespace string, name string, opts *metaV1.DeleteOptions) error
	GetDeploymentConfigScale(namespace string, name string) (map[string]interface{}, error)
	SetDeploymentConfigScale(namespace string, name string, scale map[string]interface{}) error
	GetRoutes(namespace string, labelSelector string) (map[string]interface{}, error)
	DeleteRoute(namespace string, name string, opts *metaV1.DeleteOptions) error
}

OpenShiftRESTAPI collects methods that call out to the OpenShift API server over the network

type OpenShiftRESTAPIGetter

type OpenShiftRESTAPIGetter interface {
	GetOpenShiftRESTAPI(config *KubeClientConfig) (OpenShiftRESTAPI, error)
}

OpenShiftRESTAPIGetter has a method to access the OpenShiftRESTAPI interface

Jump to

Keyboard shortcuts

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