util

package
v2.13.1 Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2024 License: Apache-2.0 Imports: 22 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// Hostname is a constant refers to the hostname part of the url
	Hostname urlPart = "Hostname"
	// Password is a constant that refers to a password portion of the url if there is one
	Password urlPart = "Password"
)
View Source
const RestrictSecretAccessEnvVar = "KEDA_RESTRICT_SECRET_ACCESS"

Variables

This section is empty.

Functions

func Contains added in v2.12.0

func Contains[T comparable](s []T, e T) bool

Contains checks if a slice contains a given element.

func CreateHTTPClient

func CreateHTTPClient(timeout time.Duration, unsafeSsl bool) *http.Client

CreateHTTPClient returns a new HTTP client with the timeout set to timeoutMS milliseconds, or 300 milliseconds if timeoutMS <= 0. unsafeSsl parameter allows to avoid tls cert validation if it's required

func CreateHTTPTransport added in v2.10.0

func CreateHTTPTransport(unsafeSsl bool) *http.Transport

CreateHTTPTransport returns a new HTTP Transport with Proxy, Keep alives unsafeSsl parameter allows to avoid tls cert validation if it's required

func CreateHTTPTransportWithTLSConfig added in v2.10.0

func CreateHTTPTransportWithTLSConfig(config *tls.Config) *http.Transport

CreateHTTPTransportWithTLSConfig returns a new HTTP Transport with Proxy, Keep alives using given tls.Config

func CreateTLSClientConfig added in v2.10.0

func CreateTLSClientConfig(unsafeSsl bool) *tls.Config

CreateTLSClientConfig returns a new TLS Config unsafeSsl parameter allows to avoid tls cert validation if it's required

func GetClusterObjectNamespace added in v2.9.0

func GetClusterObjectNamespace() (string, error)

GetClusterObjectNamespace retrieves the cluster object namespace of KEDA, default is the namespace of KEDA Operator & Metrics Server

func GetMinTLSVersion added in v2.10.0

func GetMinTLSVersion() uint16

GetMinTLSVersion return the minTLSVersion based on configurations

func GetPodNamespace added in v2.10.0

func GetPodNamespace() string

GetPodNamespace returns the namespace for the pod

func GetRestrictSecretAccess added in v2.9.0

func GetRestrictSecretAccess() string

GetRestrictSecretAccess retrieves the value of the environment variable of KEDA_RESTRICT_SECRET_ACCESS

func GetWatchNamespaces added in v2.12.0

func GetWatchNamespaces() (map[string]cache.Config, error)

GetWatchNamespaces returns the namespaces the operator should be watching for changes

func NewTLSConfig

func NewTLSConfig(clientCert, clientKey, caCert string, unsafeSsl bool) (*tls.Config, error)

NewTLSConfig returns a *tls.Config using the given ceClient cert, ceClient key, and CA certificate. If none are appropriate, a nil *tls.Config is returned.

func NewTLSConfigWithPassword added in v2.8.0

func NewTLSConfigWithPassword(clientCert, clientKey, clientKeyPassword, caCert string, unsafeSsl bool) (*tls.Config, error)

NewTLSConfigWithPassword returns a *tls.Config using the given ceClient cert, ceClient key, and CA certificate. If clientKeyPassword is not empty the provided password will be used to decrypt the given key. If none are appropriate, a nil *tls.Config is returned.

func NormalizeString

func NormalizeString(s string) string

NormalizeString will replace all slashes, dots, colons and percent signs with dashes

func ParseInt32List added in v2.9.0

func ParseInt32List(pattern string) ([]int32, error)

func ParseRange added in v2.9.0

func ParseRange(from, to string) ([]int32, error)

func ParseStringList added in v2.10.0

func ParseStringList(pattern string) (map[string]string, error)

func PrintWelcome added in v2.10.0

func PrintWelcome(logger logr.Logger, kubeVersion K8sVersion, component string)

func ResolveOsEnvBool added in v2.9.0

func ResolveOsEnvBool(envName string, defaultValue bool) (bool, error)

func ResolveOsEnvDuration added in v2.8.0

func ResolveOsEnvDuration(envName string) (*time.Duration, error)

func ResolveOsEnvInt added in v2.5.0

func ResolveOsEnvInt(envName string, defaultValue int) (int, error)

func StringPointer added in v2.12.0

func StringPointer(v string) *string

StringPointer returns a pointer to the string value passed in.

Types

type GinkgoTestReporter added in v2.13.0

type GinkgoTestReporter struct{}

func (GinkgoTestReporter) Errorf added in v2.13.0

func (g GinkgoTestReporter) Errorf(format string, args ...interface{})

func (GinkgoTestReporter) Fatalf added in v2.13.0

func (g GinkgoTestReporter) Fatalf(format string, args ...interface{})

type HTTPDoer

type HTTPDoer interface {
	Do(*http.Request) (*http.Response, error)
}

HTTPDoer is an interface that matches the Do method on (net/http).Client. It should be used in function signatures instead of raw *http.Clients wherever possible

type K8sVersion

type K8sVersion struct {
	Version       *version.Info
	MinorVersion  int
	PrettyVersion string
	Parsed        bool
}

K8sVersion holds parsed data from a K8s version

func NewK8sVersion

func NewK8sVersion(version *version.Info) K8sVersion

NewK8sVersion will parse a version info and return a struct

Jump to

Keyboard shortcuts

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