util

package
v1.56.0 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: Apache-2.0 Imports: 15 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoNamespace = fmt.Errorf("namespace not found for current environment")

ErrNoNamespace indicates that a namespace could not be found for the current environment

View Source
var ErrRunLocal = fmt.Errorf("operator run mode forced to local")

ErrRunLocal indicates that the operator is set to run in local mode (this error is returned by functions that only work on operators running in cluster mode)

View Source
var ForceRunModeEnv = "OSDK_FORCE_RUN_MODE"

ForceRunModeEnv indicates if the operator should be forced to run in either local or cluster mode (currently only used for local mode)

Functions

func AllArgs added in v1.35.0

func AllArgs(optionsList ...v1.Options) []string

AllArgs return slice of strings with all arguments

func AsOwner added in v1.11.0

func AsOwner(jaeger *v1.Jaeger) metav1.OwnerReference

AsOwner returns owner reference for jaeger

func CloseFile added in v1.36.0

func CloseFile(f *os.File, log *logr.Logger)

CloseFile closes a file and logs if there was an error

func CreateEnvsFromSecret added in v1.15.1

func CreateEnvsFromSecret(secretName string) []corev1.EnvFromSource

CreateEnvsFromSecret adds env from secret name.

func DNSName added in v1.13.0

func DNSName(name string) string

DNSName returns a dns-safe string for the given name. Any char that is not [a-z0-9] is replaced by "-" or "a". Replacement character "a" is used only at the beginning or at the end of the name. The function does not change length of the string.

func FindEnvVar added in v1.35.0

func FindEnvVar(envs []corev1.EnvVar, name string) *corev1.EnvVar

FindEnvVar return the EnvVar with given name or nil if not found

func FindItem added in v1.11.0

func FindItem(prefix string, args []string) string

FindItem returns the first item matching the given prefix

func GenerateProxySecret added in v1.17.0

func GenerateProxySecret() string

GenerateProxySecret generate random secret key for oauth proxy cookie.

func GetAdminPort added in v1.21.0

func GetAdminPort(args []string, port int32) int32

GetAdminPort returns a port, either from supplied default port, or extracted from supplied arg value. If new admin port flag exists, it will extracted from the new flag, otherwise will try to extract from deprecated flag.

func GetEsHostname added in v1.11.0

func GetEsHostname(opts map[string]interface{}) string

GetEsHostname return first ES hostname from options map

func GetOperatorNamespace added in v1.29.0

func GetOperatorNamespace() (string, error)

GetOperatorNamespace returns the namespace the operator should be running in.

func GetPort added in v1.11.1

func GetPort(arg string, args []string, port int32) int32

GetPort returns a port, either from supplied default port, or extracted from supplied arg value

func ImageName added in v1.15.0

func ImageName(image, param string) string

ImageName returns the image associated with the supplied image if defined, otherwise uses the parameter name to retrieve the value. If the parameter value does not include a tag/digest, the Jaeger version will be appended.

func InitObjectMeta added in v1.12.1

func InitObjectMeta(obj metav1.Object)

InitObjectMeta will set the required default settings to kubernetes objects metadata if is required.

func IsOTLPEnable added in v1.35.0

func IsOTLPEnable(options []string) bool

IsOTLPEnable return true if OTLP is enabled, this means --collector.otlp.enabled=true or abscense of flag, means is enabled by defaultr

func IsOTLPExplcitSet added in v1.35.0

func IsOTLPExplcitSet(options []string) bool

IsOTLPExplcitSet return true if a flag for enable the otlp is set on the options

func Labels added in v1.11.0

func Labels(name, component string, jaeger v1.Jaeger) map[string]string

Labels returns recommended labels

func Merge

func Merge(commonSpecs []v1.JaegerCommonSpec) *v1.JaegerCommonSpec

Merge returns a merged version of the list of JaegerCommonSpec instances with most specific first

func MergeResources added in v1.14.0

func MergeResources(resources *corev1.ResourceRequirements, res corev1.ResourceRequirements)

MergeResources returns a merged version of two resource requirements

func RemoveDuplicatedImagePullSecrets added in v1.19.0

func RemoveDuplicatedImagePullSecrets(imagePullSecrets []corev1.LocalObjectReference) []corev1.LocalObjectReference

RemoveDuplicatedImagePullSecrets returns a unique list of ImagePullSecrets based on ImagePullSecrets names. Only the first item is kept.

func RemoveDuplicatedVolumeMounts added in v1.19.0

func RemoveDuplicatedVolumeMounts(volumeMounts []corev1.VolumeMount) []corev1.VolumeMount

RemoveDuplicatedVolumeMounts returns a unique list based on the item names. Only the first item is kept.

func RemoveDuplicatedVolumes added in v1.18.0

func RemoveDuplicatedVolumes(volumes []corev1.Volume) []corev1.Volume

RemoveDuplicatedVolumes returns a unique list of Volumes based on Volume names. Only the first item is kept.

func RemoveEmptyVars added in v1.15.1

func RemoveEmptyVars(envVars []corev1.EnvVar) []corev1.EnvVar

RemoveEmptyVars removes empty variables from the input slice.

func ReplaceArgument added in v1.17.0

func ReplaceArgument(prefix string, newValue string, args []string) int

ReplaceArgument replace argument value with given value.

func Truncate added in v1.17.0

func Truncate(format string, max int, values ...interface{}) string

Truncate will shorten the length of the instance name so that it contains at most max chars when combined with the fixed part If the fixed part is already bigger than the max, this function is noop.

Types

type RunModeType added in v1.29.0

type RunModeType string

RunModeType cluster run mode

const (
	// LocalRunMode local run mode
	LocalRunMode RunModeType = "local"
	// ClusterRunMode cluster run mode
	ClusterRunMode RunModeType = "cluster"
)

Jump to

Keyboard shortcuts

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