common

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KuadrantNamespace             = "kuadrant-system"
	KuadrantAuthorizationProvider = "kuadrant-authorization"
	LimitadorServiceGrpcPort      = 8081
)

TODO: move the const to a proper place, or get it from config

View Source
const (
	DeleteTagAnnotation      = "kuadrant.io/delete"
	ReadyStatusConditionType = "Ready"
)

Variables

View Source
var (
	LimitadorServiceClusterHost = fmt.Sprintf("limitador.%s.svc.cluster.local", KuadrantNamespace)
)

Functions

func Contains added in v0.3.0

func Contains(slice []string, target string) bool

func FetchEnv added in v0.2.0

func FetchEnv(key string, def string) string

func GetServicePortNumber added in v0.3.0

func GetServicePortNumber(ctx context.Context, k8sClient client.Client, svcKey client.ObjectKey, svcPort string) (int32, error)

GetServicePortNumber returns the port number from the referenced key and port info the port info can be named port or already a number.

func IsObjectTaggedToDelete

func IsObjectTaggedToDelete(obj client.Object) bool

func IsOwnedBy

func IsOwnedBy(owned, owner client.Object) bool

func MergeMapStringString added in v0.3.0

func MergeMapStringString(existing *map[string]string, desired map[string]string) bool

MergeMapStringString Merge desired into existing. Not Thread-Safe. Does it matter?

func NamespacedNameToObjectKey added in v0.3.0

func NamespacedNameToObjectKey(namespacedName, defaultNamespace string) client.ObjectKey

NamespacedNameToObjectKey converts <namespace/name> format string to k8s object key. It's common for K8s to reference an object using this format. For e.g. gateways in VirtualService.

func ObjectInfo

func ObjectInfo(obj client.Object) string

func StatusConditionsMarshalJSON

func StatusConditionsMarshalJSON(input []metav1.Condition) ([]byte, error)

StatusConditionsMarshalJSON marshals the list of conditions as a JSON array, sorted by condition type.

func TagObjectToDelete

func TagObjectToDelete(obj client.Object)

Types

type RateLimitFactory added in v0.3.0

type RateLimitFactory struct {
	Key        client.ObjectKey
	Conditions []string
	MaxValue   int
	Namespace  string
	Seconds    int
	Variables  []string
}

func (*RateLimitFactory) RateLimit added in v0.3.0

Jump to

Keyboard shortcuts

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