util

package
v1.0.0-rc3 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2023 License: Apache-2.0 Imports: 31 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultRetryBackoff = wait.Backoff{
	Steps:    10,
	Duration: 5 * time.Second,
	Factor:   2.0,
	Jitter:   0.1,
}

Functions

func CompareSlice added in v0.8.0

func CompareSlice(operator v1alpha1.LogicOperator, sa []string, sb []string) bool

CompareSlice compares two slices based on operator

func ConnectToServer added in v0.10.0

func ConnectToServer(udsSockAddr string, tcpSockAddr string, serverInfo *info.ServerInfo, maxMessageSize int) (*grpc.ClientConn, error)

ConnectToServer connects to the server with the given socket address based on the server info protocol.

func GetConfigMapFromVolume

func GetConfigMapFromVolume(selector *corev1.ConfigMapKeySelector) (string, error)

GetConfigMapFromVolume retrieves the value of mounted config map volume "/var/numaflow/config/${configMapRef.name}/${configMapRef.key}" is expected to be the file path

func GetConfigMapVolumePath

func GetConfigMapVolumePath(selector *corev1.ConfigMapKeySelector) (string, error)

GetConfigMapVolumePath returns the path of the mounted configmap

func GetGSSAPIConfig added in v0.7.3

func GetGSSAPIConfig(config *dfv1.GSSAPI) (*sarama.GSSAPIConfig, error)

GetGSSAPIConfig A utility function to get sasl.gssapi.Config

func GetIsbSvcEnvVars

func GetIsbSvcEnvVars(isbSvcConfig dfv1.BufferServiceConfig) (dfv1.ISBSvcType, []corev1.EnvVar)

GetIsbSvcEnvVars is helper function to get the ISB service type and generate corresponnding environment variables

func GetSASL added in v0.8.0

func GetSASL(saslConfig *dfv1.SASL) (*struct {
	Enable                   bool
	Mechanism                sarama.SASLMechanism
	Version                  int16
	Handshake                bool
	AuthIdentity             string
	User                     string
	Password                 string
	SCRAMAuthzID             string
	SCRAMClientGeneratorFunc func() sarama.SCRAMClient
	TokenProvider            sarama.AccessTokenProvider
	GSSAPI                   sarama.GSSAPIConfig
}, error)

GetSASLConfig A utility function to get sarama.Config.Net.SASL

func GetSaramaConfigFromYAMLString

func GetSaramaConfigFromYAMLString(yaml string) (*sarama.Config, error)

GetSaramaConfigFromYAMLString parse yaml string to sarama.config

func GetSecretFromVolume

func GetSecretFromVolume(selector *corev1.SecretKeySelector) (string, error)

GetSecretFromVolume retrieves the value of mounted secret volume "/var/numaflow/secrets/${secretRef.name}/${secretRef.key}" is expected to be the file path

func GetSecretVolumePath

func GetSecretVolumePath(selector *corev1.SecretKeySelector) (string, error)

GetSecretVolumePath returns the path of the mounted secret

func GetTLSConfig

func GetTLSConfig(config *dfv1.TLS) (*tls.Config, error)

A utility function to get tls.Config

func K8sRestConfig added in v0.11.0

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

K8sRestConfig returns a rest config for the kubernetes cluster.

func LookupEnvBoolOr added in v1.0.0

func LookupEnvBoolOr(key string, defaultValue bool) bool

func LookupEnvIntOr added in v0.7.1

func LookupEnvIntOr(key string, defaultValue int) int

func LookupEnvStringOr

func LookupEnvStringOr(key, defaultValue string) string

func MustHash

func MustHash(v interface{}) string

func MustJSON

func MustJSON(in interface{}) string

func MustUnJSON

func MustUnJSON(v interface{}, in interface{})

MustUnJSON unmarshalls JSON or panics. v - must be []byte or string in - must be a pointer.

func RandomLowerCaseString

func RandomLowerCaseString(length int) string

func RandomString

func RandomString(length int) string

RandomString generate a random string with given length

func StringSliceContains

func StringSliceContains(list []string, str string) bool

func ToUDFErr added in v0.10.0

func ToUDFErr(name string, err error) error

ToUDFErr converts gRPC error to UDF Error

func VolumesFromSecretsAndConfigMaps

func VolumesFromSecretsAndConfigMaps(obj interface{}) ([]corev1.Volume, []corev1.VolumeMount)

VolumesFromSecretsOrConfigMaps builds volumes and volumeMounts spec based on the obj and its children's secretKeyselector and configMapKeySelector

func WaitForServerInfo added in v0.10.0

func WaitForServerInfo(timeout time.Duration, filePath string) (*info.ServerInfo, error)

WaitForServerInfo waits until the server info is ready. It returns an error if the server info is not ready within the given timeout.

Types

This section is empty.

Jump to

Keyboard shortcuts

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