utils

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2018 License: Apache-2.0 Imports: 38 Imported by: 30

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, hpa v2beta1.HorizontalPodAutoscaler) error

CreateAutoscale creates HPA object for function

func CreateCronJobCustomResource added in v0.5.0

func CreateCronJobCustomResource(kubelessClient versioned.Interface, cronJob *kubelessApi.CronJobTrigger) error

CreateCronJobCustomResource will create a custom function object

func CreateFunctionCustomResource added in v0.5.0

func CreateFunctionCustomResource(kubelessClient versioned.Interface, f *kubelessApi.Function) error

CreateFunctionCustomResource will create a custom function object

func CreateHTTPTriggerCustomResource added in v0.5.0

func CreateHTTPTriggerCustomResource(kubelessClient versioned.Interface, httpTrigger *kubelessApi.HTTPTrigger) error

CreateHTTPTriggerCustomResource will create a HTTP trigger custom resource object

func CreateIngress

func CreateIngress(client kubernetes.Interface, httpTriggerObj *kubelessApi.HTTPTrigger) error

CreateIngress creates ingress rule for a specific function

func CreateKafkaTriggerCustomResource added in v0.5.0

func CreateKafkaTriggerCustomResource(kubelessClient versioned.Interface, kafkaTrigger *kubelessApi.KafkaTrigger) error

CreateKafkaTriggerCustomResource will create a custom function object

func CreateServiceMonitor added in v0.3.2

func CreateServiceMonitor(smclient monitoringv1alpha1.MonitoringV1alpha1Client, funcObj *kubelessApi.Function, ns string, or []metav1.OwnerReference) error

CreateServiceMonitor creates a Service Monitor for the given function

func DeleteAutoscale added in v0.2.3

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

DeleteAutoscale deletes an autoscale rule

func DeleteCronJobCustomResource added in v0.5.0

func DeleteCronJobCustomResource(kubelessClient versioned.Interface, cronJobName, ns string) error

DeleteCronJobCustomResource will delete custom function object

func DeleteFunctionCustomResource added in v0.5.0

func DeleteFunctionCustomResource(kubelessClient versioned.Interface, funcName, ns string) error

DeleteFunctionCustomResource will delete custom function object

func DeleteHTTPTriggerCustomResource added in v0.5.0

func DeleteHTTPTriggerCustomResource(kubelessClient versioned.Interface, httpTriggerName, ns string) error

DeleteHTTPTriggerCustomResource will delete HTTP trigger custom resource object

func DeleteIngress

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

DeleteIngress deletes an ingress rule

func DeleteKafkaTriggerCustomResource added in v0.5.0

func DeleteKafkaTriggerCustomResource(kubelessClient versioned.Interface, kafkaTriggerName, ns string) error

DeleteKafkaTriggerCustomResource will delete custom function object

func DeleteServiceMonitor added in v0.2.3

func DeleteServiceMonitor(smclient monitoringv1alpha1.MonitoringV1alpha1Client, name, ns string) error

DeleteServiceMonitor cleans the sm if it exists

func EnsureCronJob added in v0.5.0

func EnsureCronJob(client kubernetes.Interface, funcObj *kubelessApi.Function, schedule string, or []metav1.OwnerReference) error

EnsureCronJob creates/updates a function cron job

func EnsureFuncConfigMap added in v0.2.4

func EnsureFuncConfigMap(client kubernetes.Interface, funcObj *kubelessApi.Function, or []metav1.OwnerReference, lr *langruntime.Langruntimes) error

EnsureFuncConfigMap creates/updates a config map with a function specification

func EnsureFuncDeployment added in v0.2.4

func EnsureFuncDeployment(client kubernetes.Interface, funcObj *kubelessApi.Function, or []metav1.OwnerReference, lr *langruntime.Langruntimes, prebuiltRuntimeImage string) error

EnsureFuncDeployment creates/updates a function deployment

func EnsureFuncImage added in v0.5.0

func EnsureFuncImage(client kubernetes.Interface, funcObj *kubelessApi.Function, lr *langruntime.Langruntimes, or []metav1.OwnerReference, imageName, tag, builderImage, registryHost, imagePullSecretName string) error

EnsureFuncImage creates a Job to build a function image

func EnsureFuncService added in v0.2.4

func EnsureFuncService(client kubernetes.Interface, funcObj *kubelessApi.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 FunctionObjAddFinalizer added in v0.5.0

func FunctionObjAddFinalizer(kubelessClient versioned.Interface, funcObj *kubelessApi.Function, finalizerString string) error

FunctionObjAddFinalizer add specified finalizer string to function object

func FunctionObjHasFinalizer added in v0.5.0

func FunctionObjHasFinalizer(funcObj *kubelessApi.Function, finalizerString string) bool

FunctionObjHasFinalizer checks if function object already has the Function controller finalizer

func FunctionObjRemoveFinalizer added in v0.5.0

func FunctionObjRemoveFinalizer(kubelessClient versioned.Interface, funcObj *kubelessApi.Function, finalizerString string) error

FunctionObjRemoveFinalizer removes the finalizer from the function object

func GetAPIExtensionsClientInCluster added in v0.5.0

func GetAPIExtensionsClientInCluster() clientsetAPIExtensions.Interface

GetAPIExtensionsClientInCluster returns a k8s clientset to access APIExtensions from inside of cluster

func GetAPIExtensionsClientOutOfCluster added in v0.5.0

func GetAPIExtensionsClientOutOfCluster() clientsetAPIExtensions.Interface

GetAPIExtensionsClientOutOfCluster returns a k8s clientset to access APIExtensions from outside of cluster

func GetAnnotationsFromCRD added in v0.5.0

func GetAnnotationsFromCRD(clientset clientsetAPIExtensions.Interface, name string) (map[string]string, error)

GetAnnotationsFromCRD gets annotations from a CustomResourceDefinition

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 GetCronJobCustomResource added in v0.5.0

func GetCronJobCustomResource(kubelessClient versioned.Interface, cronJobName, ns string) (*kubelessApi.CronJobTrigger, error)

GetCronJobCustomResource will get CronJobTrigger custom resource object

func GetCronJobTriggerOwnerReference added in v0.5.0

func GetCronJobTriggerOwnerReference(cronJobTriggerObj *kubelessApi.CronJobTrigger) ([]metav1.OwnerReference, error)

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

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) (kubelessApi.Function, error)

GetFunction returns specification of a function

func GetFunctionClientInCluster added in v0.4.0

func GetFunctionClientInCluster() (versioned.Interface, error)

GetFunctionClientInCluster returns function clientset to the request from inside of cluster

func GetFunctionCustomResource added in v0.5.0

func GetFunctionCustomResource(kubelessClient versioned.Interface, funcName, ns string) (*kubelessApi.Function, error)

GetFunctionCustomResource will delete custom function object

func GetFunctionOwnerReference added in v0.5.0

func GetFunctionOwnerReference(funcObj *kubelessApi.Function) ([]metav1.OwnerReference, error)

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

func GetHTTPTriggerCustomResource added in v0.5.0

func GetHTTPTriggerCustomResource(kubelessClient versioned.Interface, httpTriggerName, ns string) (*kubelessApi.HTTPTrigger, error)

GetHTTPTriggerCustomResource will get HTTP trigger custom resource object

func GetHTTPTriggerOwnerReference added in v0.5.0

func GetHTTPTriggerOwnerReference(httpTriggerObj *kubelessApi.HTTPTrigger) ([]metav1.OwnerReference, error)

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

func GetKafkaTriggerCustomResource added in v0.5.0

func GetKafkaTriggerCustomResource(kubelessClient versioned.Interface, kafkaTriggerName, ns string) (*kubelessApi.KafkaTrigger, error)

GetKafkaTriggerCustomResource will get CronJobTrigger custom resource object

func GetKubelessClientOutCluster added in v0.5.0

func GetKubelessClientOutCluster() (versioned.Interface, error)

GetKubelessClientOutCluster returns kubeless clientset to make kubeless API request from outside of cluster

func GetLocalHostname

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

GetLocalHostname returns hostname

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 GetRandString added in v0.5.0

func GetRandString(n int) (string, error)

GetRandString returns a random string of lenght N

func GetReadyPod

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

GetReadyPod returns the first pod has passed the liveness probe check

func MergeDeployments added in v0.4.0

func MergeDeployments(destinationDeployment *v1beta1.Deployment, sourceDeployment *v1beta1.Deployment) error

MergeDeployments merges two deployment objects

func PatchFunctionCustomResource added in v0.5.0

func PatchFunctionCustomResource(kubelessClient versioned.Interface, f *kubelessApi.Function) error

PatchFunctionCustomResource applies changes to the function custom object

func PatchHTTPTriggerCustomResource added in v0.5.0

func PatchHTTPTriggerCustomResource(kubelessClient versioned.Interface, httpTrigger *kubelessApi.HTTPTrigger) error

PatchHTTPTriggerCustomResource applies changes to the function custom object

func UpdateCronJobCustomResource added in v0.5.0

func UpdateCronJobCustomResource(kubelessClient versioned.Interface, cronJob *kubelessApi.CronJobTrigger) error

UpdateCronJobCustomResource applies changes to the function custom object

func UpdateFunctionCustomResource added in v0.5.0

func UpdateFunctionCustomResource(kubelessClient versioned.Interface, f *kubelessApi.Function) error

UpdateFunctionCustomResource applies changes to the function custom object

func UpdateHTTPTriggerCustomResource added in v0.5.0

func UpdateHTTPTriggerCustomResource(kubelessClient versioned.Interface, httpTrigger *kubelessApi.HTTPTrigger) error

UpdateHTTPTriggerCustomResource applies changes to the HTTP trigger custom resource object

func UpdateKafkaTriggerCustomResource added in v0.5.0

func UpdateKafkaTriggerCustomResource(kubelessClient versioned.Interface, kafkaTrigger *kubelessApi.KafkaTrigger) error

UpdateKafkaTriggerCustomResource 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 ConfigLocation added in v0.5.0

type ConfigLocation struct {
	Name      string
	Namespace string
}

ConfigLocation is a struct to store the location of kubeless configuration specific ConfigMap

func GetConfigLocation added in v0.5.0

func GetConfigLocation(apiExtensionsClientset clientsetAPIExtensions.Interface) (ConfigLocation, error)

GetConfigLocation returns a map which has information on the namespace where Kubeless controller is installed and the name of the ConfigMap which stores kubeless configurations

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