util

package
v0.19.1 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2020 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChannelHostName

func ChannelHostName(channelName, channelNamespace string) string

Channel Host Naming Utility

func ChannelKey

func ChannelKey(channel *kafkav1beta1.KafkaChannel) string

Create A Knative Reconciler "Key" Formatted Representation Of The Specified Channel

func ChannelLogger

func ChannelLogger(logger *zap.Logger, channel *kafkav1beta1.KafkaChannel) *zap.Logger

Get A Logger With Channel Info

func DispatcherDnsSafeName

func DispatcherDnsSafeName(channel *kafkav1beta1.KafkaChannel) string

Create A DNS Safe Name For The Specified KafkaChannel Suitable For Use With K8S Services

func GenerateHash

func GenerateHash(stringToHash string, length int) string

Generate An MD5 Hash Of A String And Return Desired Number Of Characters

func GenerateValidDnsName

func GenerateValidDnsName(name string, length int, prefix bool, suffix bool) string

Return A Valid DNS Name Which Is As Close To The Specified Name As Possible & Truncated To The Smaller Of Specified Length / 63

func HasFinalizer

func HasFinalizer(finalizer string, objectMeta *metav1.ObjectMeta) bool

Determine Whether ObjectMeta Contains Specified Finalizer

func KubernetesResourceFinalizerName

func KubernetesResourceFinalizerName(finalizerSuffix string) string

Get A Kubernetes "Qualified" Finalizer Name With The Specified Suffix

When adding finalizers to Kubernetes built-in components (Secrets, ConfigMaps, Services, etc...) it is necessary to "qualify" the finalizer name by including a "/". Kubernetes performs validation on the finalizer names and only accepts the following values if NOT qualified ...

    FinalizerOrphanDependents string = "orphan"
    FinalizerDeleteDependents string = "foregroundDeletion"
	   FinalizerKubernetes FinalizerName = "kubernetes"

... and will produce the following error message ...

metadata.finalizers[0]: Invalid value: \"externaltarget-controller\": name is neither a standard finalizer name nor is it fully qualified

This is in contrast with Finalizers on a Custom Resource which can just be any arbitrary string. There was little to no documentation on this and it required tracing the Kubernetes pkg/apis/core source code to decipher what a "qualified" name format would be.

func NewChannelOwnerReference

func NewChannelOwnerReference(channel *kafkav1beta1.KafkaChannel) metav1.OwnerReference

Create A New OwnerReference For The Specified KafkaChannel (Controller)

func NewSecretOwnerReference

func NewSecretOwnerReference(secret *corev1.Secret) metav1.OwnerReference

Create A New OwnerReference For The Specified K8S Secret (Controller)

func NewSubscriptionControllerRef

func NewSubscriptionControllerRef(subscription *messagingv1.Subscription) metav1.OwnerReference

Create A New ControllerReference Model For The Specified Subscription

func NumPartitions

func NumPartitions(channel *kafkav1beta1.KafkaChannel, configuration *config.EventingKafkaConfig, logger *zap.Logger) int32

Utility Function To Get The NumPartitions - First From Channel Spec And Then From ConfigMap-Provided Settings

func ReceiverDnsSafeName

func ReceiverDnsSafeName(kafkaSecretName string) string

Create A DNS Safe Name For The Receiver Deployment Using The Specified Kafka Secret

Note - The current implementation creates a single Receiver Deployment for each

Kafka Authentication (K8S Secrets) instance.

func RemoveFinalizer

func RemoveFinalizer(finalizer string, objectMeta *metav1.ObjectMeta)

Remove The Specified Finalizer From The Object

func ReplicationFactor

func ReplicationFactor(channel *kafkav1beta1.KafkaChannel, configuration *config.EventingKafkaConfig, logger *zap.Logger) int16

Utility Function To Get The ReplicationFactor - First From Channel Spec And Then From ConfigMap-Provided Settings

func RetentionMillis

func RetentionMillis(channel *kafkav1beta1.KafkaChannel, configuration *config.EventingKafkaConfig, logger *zap.Logger) int64

Utility Function To Get The RetentionMillis - First From Channel Spec And Then From ConfigMap-Provided Settings

func SecretLogger

func SecretLogger(logger *zap.Logger, secret *corev1.Secret) *zap.Logger

Get A Logger With Secret Info

func SubscriptionLogger

func SubscriptionLogger(logger *zap.Logger, subscription *messagingv1.Subscription) *zap.Logger

Get A Logger With Subscription Info

func TopicName

func TopicName(channel *kafkav1beta1.KafkaChannel) string

Get The TopicName For Specified KafkaChannel (ChannelNamespace.ChannelName)

Types

This section is empty.

Jump to

Keyboard shortcuts

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