utils

package
v0.0.0-...-210f5be Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ClusterAnnotationMonitor     = "k8s.io/monitor"
	ClusterAnnotationLoki        = "k8s.io/loki"
	WorkLoadAnnotationHpa        = "hpa.autoscaling.dmall.com/Hpa"
	WorkLoadAnnotationHpaMetrics = "hpa.autoscaling.dmall.com/Metrics"

	IgnoreAnnotationKey = []string{
		ClusterAnnotationMonitor,
		WorkLoadAnnotationHpa,
		WorkLoadAnnotationHpaMetrics,
	}
)

annotations need ignore key

Functions

func GetMapWithDefaultValue

func GetMapWithDefaultValue(m map[string]string, key string, def string) string

GetMapWithDefaultValue returns map specify key value, if not exist return default value

func GetPodContainerImageVersion

func GetPodContainerImageVersion(containerName string, podSpec *corev1.PodSpec) string

GetPodContainerImageVersion returns podSpec specify container image version

func MergeMap

func MergeMap(m1 map[string]string, m2 map[string]string) map[string]string

MergeMap merge map which key and values both string if m2 have same key for m1, override m1

func ObjecteMetaEqual

func ObjecteMetaEqual(obj1 metav1.Object, obj2 metav1.Object) bool

ObjecteMetaEqual compare object is equal deepequal finalizer and labels filter annotations and then deepequal annotatins

func RemoveSliceString

func RemoveSliceString(slice []string, s string) []string

RemoveSliceString remove slice unexpect key

func SliceContainsString

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

SliceContainsString return slice is contains str

func TransInt32Ptr2Int32

func TransInt32Ptr2Int32(i *int32, def int32) int32

TransInt32Ptr2Int32 transform *int32 to int32 with default value.

func TransformK8sName

func TransformK8sName(str string) string

TransformK8sName tranform kuberntes standerd name 1. replace all '_' to '-' 2. ToLower

Types

type Runnable

type Runnable interface {
	Start(ctx context.Context) error
}

Runnable define server

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server server list

func (*Server) Add

func (s *Server) Add(r Runnable)

Add add Runnable service

func (*Server) Start

func (s *Server) Start(ctx context.Context) error

Start start service

Jump to

Keyboard shortcuts

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