utils

package
v1.0.0-alpha.3 Latest Latest
Warning

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

Go to latest
Published: May 22, 2018 License: Apache-2.0 Imports: 41 Imported by: 19

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, or []metav1.OwnerReference) 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 CreateNatsTriggerCustomResource added in v0.6.0

func CreateNatsTriggerCustomResource(kubelessClient versioned.Interface, natsTrigger *kubelessApi.NATSTrigger) error

CreateNatsTriggerCustomResource 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 DeleteNatsTriggerCustomResource added in v0.6.0

func DeleteNatsTriggerCustomResource(kubelessClient versioned.Interface, natsTriggerName, ns string) error

DeleteNatsTriggerCustomResource 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, reqImage string, or []metav1.OwnerReference, reqImagePullSecret []v1.LocalObjectReference) 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, provisionImage string, imagePullSecrets []v1.LocalObjectReference) 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, dockerSecretName, provisionImage string, registryTLSEnabled bool, imagePullSecrets []v1.LocalObjectReference) 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 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 GetHTTPReq added in v0.6.0

func GetHTTPReq(clientset kubernetes.Interface, funcName, namespace, eventNamespace, method, body string) (*http.Request, error)

GetHTTPReq returns the http request object that can be used to send a event with payload to function service

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 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 GetKubelessConfig added in v1.0.0

func GetKubelessConfig(cli kubernetes.Interface, cliAPIExtensions clientsetAPIExtensions.Interface) (*v1.ConfigMap, error)

GetKubelessConfig Returns Kubeless ConfigMap

func GetLocalHostname

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

GetLocalHostname returns hostname

func GetNatsTriggerCustomResource added in v0.6.0

func GetNatsTriggerCustomResource(kubelessClient versioned.Interface, natsTriggerName, ns string) (*kubelessApi.NATSTrigger, error)

GetNatsTriggerCustomResource will get CronJobTrigger custom resource object

func GetOwnerReference added in v0.3.1

func GetOwnerReference(kind, apiVersion, name string, uid types.UID) ([]metav1.OwnerReference, error)

GetOwnerReference returns ownerRef for appending to objects's metadata

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 GetSecretsAsLocalObjectReference added in v1.0.0

func GetSecretsAsLocalObjectReference(secrets ...string) []v1.LocalObjectReference

GetSecretsAsLocalObjectReference returns a list of LocalObjectReference based on secret names

func IsJSON added in v0.6.0

func IsJSON(s string) bool

IsJSON returns true if the string is json

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 SendMessage added in v0.6.0

func SendMessage(req *http.Request) error

SendMessage sends messge over function service

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

func UpdateNatsTriggerCustomResource added in v0.6.0

func UpdateNatsTriggerCustomResource(kubelessClient versioned.Interface, natsTrigger *kubelessApi.NATSTrigger) error

UpdateNatsTriggerCustomResource 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

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