sink

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultSecretNamespace = "kollect-system" //nolint:gosec // namespace name, not a credential

Variables

This section is empty.

Functions

func RunConnectionTest added in v0.0.4

func RunConnectionTest(
	ctx context.Context,
	spec kollectdevv1alpha1.KollectSinkSpec,
	buildCtx BuildContext,
) (string, error)

RunConnectionTest probes sink connectivity using the same backends as export.

Types

type Backend

type Backend interface {
	Type() string
	Export(ctx context.Context, payload []byte, path string) error
}

Backend exports inventory payloads to an external destination.

type BuildContext added in v0.0.4

type BuildContext struct {
	CAPEM              []byte
	SecretData         map[string][]byte
	DatabaseSecretData map[string][]byte
}

BuildContext carries resolved material for backend construction.

func BuildContextFromSpec added in v0.0.4

func BuildContextFromSpec(
	ctx context.Context,
	c client.Reader,
	spec kollectdevv1alpha1.KollectSinkSpec,
	defaultNamespace string,
) (BuildContext, error)

BuildContextFromSpec resolves secrets and TLS material for a KollectSink spec.

type Credentials added in v0.0.4

type Credentials struct {
	Username string
	Password string
	Token    string
	Data     map[string][]byte
}

Credentials holds key material resolved from a Kubernetes Secret.

func ResolveSecret added in v0.0.4

func ResolveSecret(
	ctx context.Context,
	c client.Reader,
	ref *kollectdevv1alpha1.SecretReference,
	defaultNamespace string,
) (Credentials, error)

ResolveSecret loads secretRef from the API server.

type Factory

type Factory func(spec kollectdevv1alpha1.KollectSinkSpec, ctx BuildContext) (Backend, error)

Factory constructs a Backend from a KollectSink spec.

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

Registry maps sink type strings to backend factories.

func NewRegistry

func NewRegistry() *Registry

NewRegistry returns a registry with built-in backends registered.

func (*Registry) NewBackend

func (r *Registry) NewBackend(
	spec kollectdevv1alpha1.KollectSinkSpec,
	ctx BuildContext,
) (Backend, error)

NewBackend resolves spec.Type via the registry and constructs a backend instance.

func (*Registry) Register

func (r *Registry) Register(sinkType string, factory Factory)

Register adds or replaces a factory for sinkType.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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