helper

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddAnnotations

func AddAnnotations(obj metav1.Object, annotations map[string]string)

AddAnnotations adds the given annotations to the given object. if obj is nil or annotations are nil, it's a no-op.

func CreateNamespaceIfNotExist

func CreateNamespaceIfNotExist(ctx context.Context, k8sClient client.Client, namespace string) error

CreateNamespaceIfNotExist creates a namespace in case it doesn't exist.

func DeleteObject

func DeleteObject(ctx context.Context, k8sClient client.Client, obj *unstructured.Unstructured) (bool, error)

DeleteObject tries to delete the given object from k8s. returns error and true/false if object was deleted or not.

func HasAnnotation

func HasAnnotation(obj metav1.Object, annotation string) bool

HasAnnotation returns a bool if the given annotation exists in annotations.

func HasLabel

func HasLabel(obj metav1.Object, label string) bool

HasLabel returns a bool if the given label exists in labels.

func UpdateObject

func UpdateObject(ctx context.Context, k8sClient client.Client, obj *unstructured.Unstructured) error

UpdateObject function updates a given k8s object.

Types

type ConfigManager

type ConfigManager struct {
	LeafHubName                  string
	PodNameSpace                 string
	TransportType                string
	TransportCompressionType     string
	SpecWorkPoolSize             int
	SpecEnforceHohRbac           bool
	StatusDeltaCountSwitchFactor int
	Kafka                        *KafkaConfig
	SyncService                  *SyncServiceConfig
}

func NewConfigManager

func NewConfigManager() (*ConfigManager, error)

func (*ConfigManager) GetKafkaConfigMap

func (configManager *ConfigManager) GetKafkaConfigMap() (*kafka.ConfigMap, error)

func (*ConfigManager) GetProducerKafkaConfigMap

func (configManager *ConfigManager) GetProducerKafkaConfigMap() (*kafka.ConfigMap, error)

type KafkaConfig

type KafkaConfig struct {
	BootstrapServers     string
	SslCa                string
	ComsumerTopic        string
	ProducerId           string
	ProducerTopic        string
	ProducerMessageLimit int
}

type LabelsField

type LabelsField struct {
	Labels map[string]struct{} `json:"f:labels"`
}

LabelsField presents a "f:labels" field subfield of metadataField.

type MetadataField

type MetadataField struct {
	LabelsField `json:"f:metadata"`
}

MetadataField presents a "f:metadata" field subfield of v1.FieldsV1.

type SyncServiceConfig

type SyncServiceConfig struct {
	Protocol                string
	ConsumerHost            string
	ConsumerPort            int
	ConsumerPollingInterval int
	ProducerHost            string
	ProducerPort            int
}

Jump to

Keyboard shortcuts

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