internal

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2022 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CreatedByAnnotationKey https://kubernetes.io/docs/reference/labels-annotations-taints/#app-kubernetes-io-created-by
	CreatedByAnnotationKey = "app.kubernetes.io/created-by"

	// CreatedByAnnotationValue https://kubernetes.io/docs/reference/labels-annotations-taints/#app-kubernetes-io-created-by
	CreatedByAnnotationValue = "log2rbac"
)

Various constants used across the log2rbac

Variables

This section is empty.

Functions

func PrintBanner

func PrintBanner(cfg *LogConfig)

PrintBanner prints the ascii banner for log2rbac app in logs the fatih/color module should be smart enough to recognize the attached stdout's file descriptor if it's capable of colors, but we can explicitly control this by cfg.Colors bool

func PrintInfo added in v0.0.2

func PrintInfo(log logr.Logger, version string)

PrintInfo prints the versions of golang and the git-sha to the logs

func ServeRoot added in v0.0.5

func ServeRoot(mgr manager.Manager, cfg AppConfig) error

func SetupLog

func SetupLog(cfg *LogConfig)

SetupLog tweak the default log to use custom time format and use colors if supported

func SetupTracing added in v0.0.4

func SetupTracing(cfg Config, ctx context.Context, log logr.Logger) func()

Types

type AppConfig added in v0.0.4

type AppConfig struct {
	Version string
	GitSha  string
}

AppConfig contains application specific info

type Config

type Config struct {
	Log        *LogConfig
	Controller *ControllerConfig
	Tracing    *TracingConfig
	App        *AppConfig
}

Config is top-lvl entrypoint to the configuration of log2rbac operator

type ControllerConfig

type ControllerConfig struct {
	// sync intervals
	SyncIntervalAfterNoRbacEntryMinutes int     `env:"SYNC_INTERVAL_AFTER_NO_RBAC_ENTRY_MINUTES,default=5"`
	SyncIntervalAfterNoLogsSeconds      int     `env:"SYNC_INTERVAL_AFTER_NO_LOGS_SECONDS,default=30"`
	SyncIntervalAfterPodRestartSeconds  int     `env:"SYNC_INTERVAL_AFTER_POD_RESTART_SECONDS,default=20"`
	SyncIntervalAfterErrorMinutes       int     `env:"SYNC_INTERVAL_AFTER_ERROR,default=3"`
	IgnoreSameEventsWithinSeconds       float64 `env:"IGNORE_SAME_EVENTS_WITHIN_SECONDS,default=1.0"`

	ShouldRestartAppPods bool `env:"SHOULD_RESTART_APP_PODS,default=true"`
}

ControllerConfig contains internal parameters for the controller like sync intervals

type LogConfig

type LogConfig struct {
	Colors   bool `env:"COLORS,default=true"`
	NoBanner bool `env:"NO_BANNER,default=false"`
}

LogConfig contains log related configuration

type TracingConfig added in v0.0.4

type TracingConfig struct {
	Enabled       bool   `env:"TRACING_ENABLED,default=false"`
	Endpoint      string `env:"OTEL_EXPORTER_OTLP_ENDPOINT,default=localhost:4318"`
	SamplingRatio string `env:"TRACING_SAMPLING_RATIO"`
}

TracingConfig contains options related to distributed tracing and opentelemetry

Jump to

Keyboard shortcuts

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