utils

package
v0.0.0-...-81cd6e7 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	DefaultWorkingDir = "/tmp/ocp-eo"
	OsNodeLabel       = "kubernetes.io/os"
	LinuxValue        = "linux"
)

Variables

This section is empty.

Functions

func AddOwnerRefToObject

func AddOwnerRefToObject(object metav1.Object, ownerRef metav1.OwnerReference)

AddOwnerRefToObject adds the parent as an owner to the child

func AreMapsSame

func AreMapsSame(lhs, rhs map[string]string) bool

func AreTolerationsSame

func AreTolerationsSame(lhs, rhs []corev1.Toleration) bool

func CalculateMD5Hash

func CalculateMD5Hash(text string) (string, error)

CalculateMD5Hash returns a MD5 hash of the give text

func CompareResources

func CompareResources(current, desired v1.ResourceRequirements) (bool, v1.ResourceRequirements)

func ContainerSecurityContext

func ContainerSecurityContext() *corev1.SecurityContext

func Contains

func Contains(list []string, s string) bool

func ContainsString

func ContainsString(slice []string, s string) bool

func EnsureLinuxNodeSelector

func EnsureLinuxNodeSelector(selectors map[string]string) map[string]string

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. See https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#interlude-built-in-node-labels

func EnvValueEqual

func EnvValueEqual(env1, env2 []corev1.EnvVar) bool

* 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 corev1.ResourceFieldSelector) bool

func EnvVarSourceEqual

func EnvVarSourceEqual(esource1, esource2 corev1.EnvVarSource) bool

func GetInt32

func GetInt32(value int32) *int32

func GetInt64

func GetInt64(value int64) *int64

func GetMajorVersion

func GetMajorVersion(v string) string

func GetWorkingDirFilePath

func GetWorkingDirFilePath(toFile string) string

func LookupEnvWithDefault

func LookupEnvWithDefault(envName, defaultValue string) string

func PodSecurityContext

func PodSecurityContext() corev1.PodSecurityContext

func RandStringBytes

func RandStringBytes(length uint) (string, error)

func RemoveString

func RemoveString(slice []string, s string) (result []string)

func SetProxyEnvVars

func SetProxyEnvVars(proxyConfig *configv1.Proxy) []corev1.EnvVar

func ToJSON

func ToJSON(obj interface{}) (string, error)

func WriteToWorkingDirFile

func WriteToWorkingDirFile(toFile string, value []byte) error

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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