utils

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2020 License: Apache-2.0 Imports: 26 Imported by: 2

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

func CreateAutoscale(client kubernetes.Interface, hpa v2beta1.HorizontalPodAutoscaler) error

CreateAutoscale creates HPA object for function

func CreateKafkaTriggerCustomResource

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

CreateKafkaTriggerCustomResource will create a custom function object

func DeleteAutoscale

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

DeleteAutoscale deletes an autoscale rule

func DeleteKafkaTriggerCustomResource

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

DeleteKafkaTriggerCustomResource will delete custom function object

func DeleteServiceMonitor

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

DeleteServiceMonitor cleans the sm if it exists

func GetAPIExtensionsClientInCluster

func GetAPIExtensionsClientInCluster() clientsetAPIExtensions.Interface

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

func GetAPIExtensionsClientOutOfCluster

func GetAPIExtensionsClientOutOfCluster() clientsetAPIExtensions.Interface

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

func GetAnnotationsFromCRD

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 GetFunctionPort

func GetFunctionPort(clientset kubernetes.Interface, namespace, functionName string) (int, error)

GetFunctionPort returns the port for a function service

func GetHTTPReq

func GetHTTPReq(funcName string, funcPort int, kafkaTopic, 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 GetKafkaTriggerCustomResource

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

GetKafkaTriggerCustomResource will get CronJobTrigger custom resource object

func GetKubelessClientOutCluster

func GetKubelessClientOutCluster() (versioned.Interface, error)

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

func GetRandString

func GetRandString(n int) (string, error)

GetRandString returns a random string of lenght N

func GetSecretsAsLocalObjectReference

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

GetSecretsAsLocalObjectReference returns a list of LocalObjectReference based on secret names

func GetTriggerClientInCluster

func GetTriggerClientInCluster() (versioned.Interface, error)

GetTriggerClientInCluster returns function clientset to the request from inside of cluster

func IsJSON

func IsJSON(s string) bool

IsJSON returns true if the string is json

func MergeDeployments

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

MergeDeployments merges two deployment objects

func SendMessage

func SendMessage(req *http.Request) error

SendMessage sends messge over function service

func UpdateKafkaTriggerCustomResource

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

UpdateKafkaTriggerCustomResource applies changes to the function custom object

Types

This section is empty.

Jump to

Keyboard shortcuts

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