{"modulePath":"github.com/KusionStack/controller-mesh","version":"v0.2.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package utils\n\n## Constants\n\n```go\nconst (\n\tSlowStartInitialBatchSize = 1\n)\n```\n\n## Variables\n\n```go\nvar (\n\tEnvPodNamespaceVal = os.Getenv(\"POD_NAMESPACE\")\n\tEnvPodNameVal      = os.Getenv(\"POD_NAME\")\n\tEnvPodIpVal        = os.Getenv(\"POD_IP\")\n)\n```\n\n## Functions\n\n```go\nfunc CombineLabelSelectors(ls ...labels.Selector) labels.Selector\n```\n\n```go\nfunc DumpJSON(o interface{}) string\n```\nDumpJSON returns the JSON encoding\n\n```go\nfunc GetCertDir() string\n```\n\n```go\nfunc GetCertWriter() string\n```\n\n```go\nfunc GetContainerEnvVar(container *v1.Container, key string) *v1.EnvVar\n```\n\n```go\nfunc GetHost() string\n```\n\n```go\nfunc GetMD5Hash(text string) string\n```\n\n```go\nfunc GetNamespace() string\n```\n\n```go\nfunc GetPodCondition(status *v1.PodStatus, conditionType v1.PodConditionType) (int, *v1.PodCondition)\n```\nGetPodCondition extracts the provided condition from the given status and returns that. Returns nil and -1 if the condition is not present, and the index of the located condition.\n\n```go\nfunc GetPodConditionFromList(conditions []v1.PodCondition, conditionType v1.PodConditionType) (int, *v1.PodCondition)\n```\nGetPodConditionFromList extracts the provided condition from the given list of condition and returns the index of the condition and the condition. Returns -1 and nil if the condition is not present.\n\n```go\nfunc GetPodReadyCondition(status v1.PodStatus) *v1.PodCondition\n```\nGetPodReadyCondition extracts the pod ready condition from the given status and returns that. Returns nil if the condition is not present.\n\n```go\nfunc GetPort() int\n```\n\n```go\nfunc GetSecretName() string\n```\n\n```go\nfunc GetServiceName() string\n```\n\n```go\nfunc HttpToAPIError(code int, verb, serverMessage string) *metav1.Status\n```\nHttpToAPIError convert http error to kubernetes api error\n\n```go\nfunc Init() error\n```\n\n```go\nfunc InitFlags(flagset *flag.FlagSet)\n```\n\n```go\nfunc IsHashChangedError(err error) bool\n```\n\n```go\nfunc IsPodActive(p *v1.Pod) bool\n```\n\n```go\nfunc IsPodReady(pod *v1.Pod) bool\n```\nIsPodReady returns true if a pod is ready; false otherwise.\n\n```go\nfunc IsPodReadyConditionTrue(status v1.PodStatus) bool\n```\nIsPodReadyConditionTrue returns true if a pod is ready; false otherwise.\n\n```go\nfunc Key(namespace, name string) string\n```\n\n```go\nfunc KeyFunc(obj metav1.Object) string\n```\n\n```go\nfunc LastReplace(s, old, new string) string\n```\n\n```go\nfunc MergeLabelSelector(selA, selB *metav1.LabelSelector) *metav1.LabelSelector\n```\n\n```go\nfunc NegateLabelSelector(sel *metav1.LabelSelector) *metav1.LabelSelector\n```\n\n```go\nfunc NewClientFromManager(mgr manager.Manager, name string) client.Client\n```\n\n```go\nfunc NewDirectorClientFromManager(mgr manager.Manager, name string) client.Client\n```\n\n```go\nfunc SlowStartBatch(count int, initialBatchSize int, shortCircuit bool, fn func(int, error) error, maxBatchSize int) (int, error)\n```\nSlowStartBatch tries to call the provided function a total of 'count' times, starting slow to check for errors, then speeding up if calls succeed.\n\nIt groups the calls into batches, starting with a group of initialBatchSize. Within each batch, it may call the function multiple times concurrently.\n\nIf a whole batch succeeds, the next batch may get exponentially larger. If there are any failures in a batch, all remaining batches are skipped after waiting for the current batch to complete.\n\nIt returns the number of successful calls to the function.\n\n```go\nfunc ValidatedLabelSelectorAsSelector(ps *metav1.LabelSelector) (labels.Selector, error)\n```\n\n## Types\n\n```go\ntype HashChangedError struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc (e HashChangedError) Error() string\n```\n\n```go\nfunc (e HashChangedError) String() string\n```\n\n","path":"github.com/KusionStack/controller-mesh/pkg/utils","name":"utils","synopsis":"","isRedistributable":true}
