Documentation ¶
Index ¶
- Constants
- Variables
- func AddLabels(object metav1.Object, labels map[string]string)
- func AddOwnerRefToObject(object metav1.Object, ownerRef metav1.OwnerReference)
- func AreMapsSame(lhs, rhs map[string]string) bool
- func AreResourcesDifferent(current, desired *v1.PodSpec) bool
- func AreResourcesSame(current, desired *v1.ResourceRequirements) bool
- func AreTolerationsSame(lhs, rhs []v1.Toleration) bool
- func AsOwner(o runtime.Object) metav1.OwnerReference
- func CalculateMD5Hash(text string) (string, error)
- func EnsureLinuxNodeSelector(selectors map[string]string) map[string]string
- func EnvValueEqual(env1, env2 []v1.EnvVar) bool
- func EnvVarResourceFieldSelectorEqual(resource1, resource2 v1.ResourceFieldSelector) bool
- func EnvVarSourceEqual(esource1, esource2 v1.EnvVarSource) bool
- func GetCollectorName(collectorType logging.LogCollectionType) string
- func GetComponentImage(component string) string
- func GetEnvVar(name string, envVars []v1.EnvVar) (v1.EnvVar, bool)
- func GetFileContents(filePath string) []byte
- func GetProxyEnvVars() []v1.EnvVar
- func GetPtr[T any](value T) *T
- func HasSameOwner(curr []metav1.OwnerReference, desired []metav1.OwnerReference) bool
- func InitLogger(component string) logr.Logger
- func PodVolumeEquivalent(lhs, rhs []v1.Volume) bool
- func RemoveString(slice []string, s string) (result []string)
- func ToJsonLogs(logs []string) string
- func WrapError(err error) error
- type Float64Map
- type StringMap
Constants ¶
const ( OsNodeLabel = "kubernetes.io/os" LinuxValue = "linux" )
Variables ¶
var COMPONENT_IMAGES = map[string]string{ constants.CollectorName: constants.FluentdImageEnvVar, constants.FluentdName: constants.FluentdImageEnvVar, constants.VectorName: constants.VectorImageEnvVar, "kibana": "KIBANA_IMAGE", constants.LogfilesmetricexporterName: constants.LogfilesmetricImageEnvVar, constants.ConsolePluginName: constants.ConsolePluginImageEnvVar, }
COMPONENT_IMAGES are thee keys are based on the "container name" + "-{image,version}"
var (
DefaultNodeSelector = map[string]string{OsNodeLabel: LinuxValue}
)
Functions ¶
func AddOwnerRefToObject ¶
func AddOwnerRefToObject(object metav1.Object, ownerRef metav1.OwnerReference)
AddOwnerRefToObject adds the parent as an owner to the child
func AreMapsSame ¶
func AreResourcesDifferent ¶
func AreResourcesSame ¶
func AreResourcesSame(current, desired *v1.ResourceRequirements) bool
func AreTolerationsSame ¶
func AreTolerationsSame(lhs, rhs []v1.Toleration) bool
func CalculateMD5Hash ¶
CalculateMD5Hash returns a MD5 hash of the give text
func EnsureLinuxNodeSelector ¶
EnsureLinuxNodeSelector takes given selector map and returns a selector map with linux node selector added into it. If there is already a node type selector and is different from "linux" then it is overridden and warning is logged. See https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#interlude-built-in-node-labels
func EnvValueEqual ¶
* EnvValueEqual - check if 2 EnvValues are equal or not Notes: - reflect.DeepEqual does not return expected results if the to-be-compared value is a pointer. - needs to adjust with k8s.io/api/core/v#/types.go when the types are updated. *
func EnvVarResourceFieldSelectorEqual ¶
func EnvVarResourceFieldSelectorEqual(resource1, resource2 v1.ResourceFieldSelector) bool
func EnvVarSourceEqual ¶
func EnvVarSourceEqual(esource1, esource2 v1.EnvVarSource) bool
func GetCollectorName ¶
func GetCollectorName(collectorType logging.LogCollectionType) string
func GetComponentImage ¶
GetComponentImage returns a full image pull spec for a given component based on the component type
func GetFileContents ¶
func GetProxyEnvVars ¶
func HasSameOwner ¶
func HasSameOwner(curr []metav1.OwnerReference, desired []metav1.OwnerReference) bool
func InitLogger ¶
InitLogger creates a logger and optionally initializes the verbosity with the value in LOG_LEVEL.
It also replaces the static logger with the newly-created logger.
func PodVolumeEquivalent ¶
func RemoveString ¶
func ToJsonLogs ¶
Types ¶
type Float64Map ¶
type Float64Map struct {
// contains filtered or unexported fields
}
func InitFloat64Map ¶
func InitFloat64Map(m map[string]float64) *Float64Map
func (*Float64Map) Get ¶
func (fm *Float64Map) Get(key string) float64
for prometheus gauge metric getting a value of float64
func (*Float64Map) Inc ¶
func (fm *Float64Map) Inc(key string)
for prometheus gauge metric setting up a value of float64
func (*Float64Map) Range ¶
func (fm *Float64Map) Range(f func(key, value interface{}) bool)