utils

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2017 License: Apache-2.0 Imports: 37 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildOutOfClusterConfig

func BuildOutOfClusterConfig() (*rest.Config, error)

BuildOutOfClusterConfig returns k8s config

func CreateAutoscale added in v0.2.3

func CreateAutoscale(client kubernetes.Interface, funcObj *spec.Function, ns, metric string, min, max int32, value string) error

CreateAutoscale creates HPA object for function

func CreateIngress

func CreateIngress(client kubernetes.Interface, funcObj *spec.Function, ingressName, hostname, ns string, enableTLSAcme bool) error

CreateIngress creates ingress rule for a specific function

func CreateK8sCustomResource

func CreateK8sCustomResource(crdClient rest.Interface, f *spec.Function) error

CreateK8sCustomResource will create a custom function object

func DeleteAutoscale added in v0.2.3

func DeleteAutoscale(client kubernetes.Interface, name, ns string) error

DeleteAutoscale deletes an autoscale rule

func DeleteIngress

func DeleteIngress(client kubernetes.Interface, name, ns string) error

DeleteIngress deletes an ingress rule

func DeleteK8sCustomResource

func DeleteK8sCustomResource(crdClient *rest.RESTClient, funcName, ns string) error

DeleteK8sCustomResource will delete custom function object

func DeleteServiceMonitor added in v0.2.3

func DeleteServiceMonitor(name, ns string) error

DeleteServiceMonitor cleans the sm if it exists

func EnsureFuncConfigMap added in v0.2.4

func EnsureFuncConfigMap(client kubernetes.Interface, funcObj *spec.Function, or []metav1.OwnerReference) error

EnsureFuncConfigMap creates/updates a config map with a function specification

func EnsureFuncCronJob added in v0.2.4

func EnsureFuncCronJob(client rest.Interface, funcObj *spec.Function, or []metav1.OwnerReference, groupVersion string) error

EnsureFuncCronJob creates/updates a function cron job

func EnsureFuncDeployment added in v0.2.4

func EnsureFuncDeployment(client kubernetes.Interface, funcObj *spec.Function, or []metav1.OwnerReference) error

EnsureFuncDeployment creates/updates a function deployment

func EnsureFuncService added in v0.2.4

func EnsureFuncService(client kubernetes.Interface, funcObj *spec.Function, or []metav1.OwnerReference) error

EnsureFuncService creates/updates a function service

func Exec added in v0.2.4

func Exec(client corev1.CoreV1Interface, pod, namespace string, opts v1.PodExecOptions) (*http.Request, error)

Exec returns an "exec" Request suitable for ExecRoundTripper.

func ExecRoundTripper added in v0.2.4

func ExecRoundTripper(conf *rest.Config, f RoundTripCallback) (http.RoundTripper, error)

ExecRoundTripper creates a wrapped WebsocketRoundTripper

func GetCRDClient added in v0.2.4

func GetCRDClient() (*rest.RESTClient, error)

GetCRDClient returns crd client to the request from inside of cluster

func GetCRDClientOutOfCluster added in v0.2.4

func GetCRDClientOutOfCluster() (*rest.RESTClient, error)

GetCRDClientOutOfCluster returns crd client to the request from outside of cluster

func GetClient

func GetClient() kubernetes.Interface

GetClient returns a k8s clientset to the request from inside of cluster

func GetClientOutOfCluster

func GetClientOutOfCluster() kubernetes.Interface

GetClientOutOfCluster returns a k8s clientset to the request from outside of cluster

func GetDefaultNamespace added in v0.3.0

func GetDefaultNamespace() string

GetDefaultNamespace returns the namespace set in current cluster context

func GetFunction

func GetFunction(funcName, ns string) (spec.Function, error)

GetFunction returns specification of a function

func GetLocalHostname

func GetLocalHostname(config *rest.Config, funcName string) (string, error)

GetLocalHostname returns hostname

func GetOwnerReference added in v0.3.1

func GetOwnerReference(funcObj *spec.Function) ([]metav1.OwnerReference, error)

GetOwnerReference returns ownerRef for appending to objects's metadata created by kubeless-controller one a function is deployed.

func GetPodsByLabel

func GetPodsByLabel(c kubernetes.Interface, ns, k, v string) (*v1.PodList, error)

GetPodsByLabel returns list of pods which match the label We use this to returns pods to which the function is deployed or pods running controllers

func GetReadyPod

func GetReadyPod(pods *v1.PodList) (v1.Pod, error)

GetReadyPod returns the first pod has passed the liveness probe check

func GetRestClient

func GetRestClient() (*rest.RESTClient, error)

GetRestClient returns a k8s restclient to the request from inside of cluster

func GetRestClientOutOfCluster added in v0.2.4

func GetRestClientOutOfCluster(group, apiVersion, apiPath string) (*rest.RESTClient, error)

GetRestClientOutOfCluster returns a REST client based on a group, API version and path

func GetServiceMonitorClientOutOfCluster added in v0.2.3

func GetServiceMonitorClientOutOfCluster() (*monitoringv1alpha1.MonitoringV1alpha1Client, error)

GetServiceMonitorClientOutOfCluster returns sm client to the request from outside of cluster

func UpdateK8sCustomResource

func UpdateK8sCustomResource(crdClient rest.Interface, f *spec.Function) error

UpdateK8sCustomResource applies changes to the function custom object

Types

type Cmd added in v0.2.4

type Cmd struct {
	Stdin  io.Reader
	Stdout io.Writer
	Stderr io.Writer
}

Cmd stores information relevant to an individual remote command being run

func (*Cmd) RoundTripCallback added in v0.2.4

func (c *Cmd) RoundTripCallback(conn *websocket.Conn) (*http.Response, error)

RoundTripCallback is suitable to use with `ExecRoundTripper` and will copy data to/from stdio channels. The returned `Response` is currently always `nil`.

type RoundTripCallback added in v0.2.4

type RoundTripCallback func(conn *websocket.Conn) (*http.Response, error)

A RoundTripCallback is used to process the websocket from an individual command execution.

type WebsocketRoundTripper added in v0.2.4

type WebsocketRoundTripper struct {
	TLSConfig *tls.Config
	Do        RoundTripCallback
}

WebsocketRoundTripper is an http.RoundTripper that invokes a callback on a websocket connection.

func (*WebsocketRoundTripper) RoundTrip added in v0.2.4

func (d *WebsocketRoundTripper) RoundTrip(r *http.Request) (*http.Response, error)

RoundTrip implements the http.RoundTripper interface.

Jump to

Keyboard shortcuts

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