Documentation ¶
Index ¶
- Constants
- func ConfigureMaxProcs(logger klog.Logger) error
- func Contains[T comparable](s []T, e T) bool
- func CreateHTTPClient(timeout time.Duration, unsafeSsl bool) *http.Client
- func CreateHTTPTransport(unsafeSsl bool) *http.Transport
- func CreateHTTPTransportWithTLSConfig(config *tls.Config) *http.Transport
- func CreateTLSClientConfig(unsafeSsl bool) *tls.Config
- func GetClusterObjectNamespace() (string, error)
- func GetMinTLSVersion() uint16
- func GetPodNamespace() string
- func GetRestrictSecretAccess() string
- func GetValueByPath(data map[string]interface{}, path string) (interface{}, error)
- func GetWatchNamespaces() (map[string]cache.Config, error)
- func IgnoreOtherNamespaces() predicate.Predicate
- func NewTLSConfig(clientCert, clientKey, caCert string, unsafeSsl bool) (*tls.Config, error)
- func NewTLSConfigWithPassword(clientCert, clientKey, clientKeyPassword, caCert string, unsafeSsl bool) (*tls.Config, error)
- func NormalizeString(s string) string
- func ParseInt32List(pattern string) ([]int32, error)
- func ParseRange(from, to string) ([]int32, error)
- func ParseStringList(pattern string) (map[string]string, error)
- func PrintWelcome(logger logr.Logger, kubeVersion K8sVersion, component string)
- func ResolveOsEnvBool(envName string, defaultValue bool) (bool, error)
- func ResolveOsEnvDuration(envName string) (*time.Duration, error)
- func ResolveOsEnvInt(envName string, defaultValue int) (int, error)
- func SetCACertDirs(caCertDirs []string)
- func StringPointer(v string) *string
- type GinkgoTestReporter
- type HTTPDoer
- type K8sVersion
Constants ¶
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" )
const RestrictSecretAccessEnvVar = "KEDA_RESTRICT_SECRET_ACCESS"
Variables ¶
This section is empty.
Functions ¶
func ConfigureMaxProcs ¶ added in v2.16.1
func ConfigureMaxProcs(logger klog.Logger) error
ConfigureMaxProcs sets up automaxprocs with proper logging configuration. It wraps the automaxprocs logger to handle structured logging with string keys to prevent panics when automaxprocs tries to pass numeric keys.
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 ¶
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
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
CreateHTTPTransportWithTLSConfig returns a new HTTP Transport with Proxy, Keep alives using given tls.Config
func CreateTLSClientConfig ¶ added in v2.10.0
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
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 GetValueByPath ¶ added in v2.14.0
GetValueByPath retrieves a value from a nested map using a dot-separated path It also supports .number syntax to access array elements.
This is a helper function for niche use cases. Consider using https://pkg.go.dev/k8s.io/apimachinery@v0.29.3/pkg/apis/meta/v1/unstructured#NestedFieldNoCopy instead
Examples:
data := map[string]interface{}{ "a": map[string]interface{}{ "b": []interface{}{ map[string]interface{}{"c": 1}, map[string]interface{}{"c": 2}, }, }, }
GetValueByPath(data, "a.b.0.c") // 1 GetValueByPath(data, "not.found") // error
func GetWatchNamespaces ¶ added in v2.12.0
GetWatchNamespaces returns the namespaces the operator should be watching for changes
func IgnoreOtherNamespaces ¶ added in v2.14.0
IgnoreOtherNamespaces returns the predicate for watched events that will filter out those that are not coming from a watched namespace (empty namespace or unset env var denotes all)
func NewTLSConfig ¶
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 ¶
NormalizeString will replace all slashes, dots, colons and percent signs with dashes
func ParseInt32List ¶ added in v2.9.0
func ParseRange ¶ added in v2.9.0
func ParseStringList ¶ added in v2.10.0
func PrintWelcome ¶ added in v2.10.0
func PrintWelcome(logger logr.Logger, kubeVersion K8sVersion, component string)
func ResolveOsEnvBool ¶ added in v2.9.0
func ResolveOsEnvDuration ¶ added in v2.8.0
func ResolveOsEnvInt ¶ added in v2.5.0
func SetCACertDirs ¶ added in v2.15.0
func SetCACertDirs(caCertDirs []string)
SetCACertDirs sets location(s) containing CA certificates which should be trusted for all future calls to CreateTLSClientConfig
func StringPointer ¶ added in v2.12.0
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 ¶
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 ¶
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