syncclientutils

package
v1.11.0-cni-plu...-8f3027a Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2024 License: Apache-2.0, Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MustStartSyncerClientIfTyphaConfigured

func MustStartSyncerClientIfTyphaConfigured(
	typhaConfig *TyphaConfig,
	syncerType syncproto.SyncerType,
	myVersion, myHostname, myInfo string,
	cbs api.SyncerCallbacks,
) bool

MustStartSyncerClientIfTyphaConfigured starts a syncer of the requested type if typha is configured to be running. - This returns true if the syncer was started successfully. - This returns false if typha is not configured to be running. - This logs and exits if typha is configured but it failed to locate the service or connect a syncer client.

The typha address may be directly configured in the typha config, or will otherwise be looked by finding the associated Kubernetes service.

Types

type TyphaConfig

type TyphaConfig struct {
	Addr           string
	K8sServiceName string
	K8sNamespace   string
	ReadTimeout    time.Duration
	WriteTimeout   time.Duration

	// Client-side TLS config for communication with Typha.  If any of these are
	// specified, they _all_ must be - except that either CN or URISAN may be left unset.
	// confd will then initiate a secure (TLS) connection to Typha.  Typha must present a
	// certificate signed by a CA in CAFile, and with CN matching CN or URI SAN matching
	// URISAN.
	KeyFile  string
	CertFile string
	CAFile   string
	CN       string
	URISAN   string
}

TyphaConfig specifies the sync-client connection parameters

func ReadTyphaConfig

func ReadTyphaConfig(supportedPrefixes []string) TyphaConfig

ReadTyphaConfig reads the TyphaConfig from environment variables.

The supportedPrefixes is the set of allowed prefixes for each environment name. Name format is therefore: <prefix>TYPHA<fieldname uppercase>, e.g. CONFD_TYPHAADDR

Jump to

Keyboard shortcuts

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