util

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: May 8, 2020 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChannelDnsSafeName

func ChannelDnsSafeName(kafkaSecretName string) string

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

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

Kafka Authentication (K8S Secrets) instance.

func ChannelHostName

func ChannelHostName(channelName, channelNamespace string) string

Channel Host Naming Utility

func ChannelKey

func ChannelKey(channel *kafkav1alpha1.KafkaChannel) string

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

func ChannelLogger

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

Get A Logger With Channel Info

func DispatcherDnsSafeName

func DispatcherDnsSafeName(channel *kafkav1alpha1.KafkaChannel) string

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

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 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 *kafkav1alpha1.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 *messagingv1alpha1.Subscription) metav1.OwnerReference

Create A New ControllerReference Model For The Specified Subscription

func NumPartitions

func NumPartitions(channel *kafkav1alpha1.KafkaChannel, environment *env.Environment, logger *zap.Logger) int

Utility Function To Get The NumPartitions - First From Channel Spec And Then From Environment

func ReplicationFactor

func ReplicationFactor(channel *kafkav1alpha1.KafkaChannel, environment *env.Environment, logger *zap.Logger) int

Utility Function To Get The ReplicationFactor - First From Channel Spec And Then From Environment

func RetentionMillis

func RetentionMillis(channel *kafkav1alpha1.KafkaChannel, environment *env.Environment, logger *zap.Logger) int64

Utility Function To Get The RetentionMillis - First From Channel Spec And Then From Environment

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 *messagingv1alpha1.Subscription) *zap.Logger

Get A Logger With Subscription Info

func TopicName

func TopicName(channel *kafkav1alpha1.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