controller

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2023 License: Apache-2.0 Imports: 47 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventPod            = "pod"
	EventLogConf        = "logConfig"
	EventNode           = "node"
	EventVm             = "vm"
	EventClusterLogConf = "clusterLogConfig"
	EventSink           = "sink"
	EventInterceptor    = "interceptor"

	InjectorAnnotationKey       = "sidecar.loggie.io/inject"
	InjectorAnnotationValueTrue = "true"
)
View Source
const (
	ReasonFailed  = "syncFailed"
	ReasonSuccess = "syncSuccess"

	MessageSyncSuccess = "Sync %s %v success"
	MessageSyncFailed  = "Sync %s failed: %s"
)
View Source
const (
	GenerateConfigName           = "kube-loggie.yml"
	GenerateTypeLoggieConfigName = "cluster-config.yml"
	GenerateTypeNodeConfigName   = "node-config.yml"
	GenerateTypeVmConfigName     = "vm-config.yml"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Cluster        string `yaml:"cluster" default:""`
	Kubeconfig     string `yaml:"kubeconfig"`
	Master         string `yaml:"master"`
	NodeName       string `yaml:"-"`
	ConfigFilePath string `yaml:"-"`

	ContainerRuntime        string   `yaml:"containerRuntime"`
	RuntimeEndpoints        []string `` /* 147-byte string literal not displayed */
	RootFsCollectionEnabled bool     `yaml:"rootFsCollectionEnabled"`
	PodLogDirPrefix         string   `yaml:"podLogDirPrefix" default:"/var/log/pods"`
	KubeletRootDir          string   `yaml:"kubeletRootDir" default:"/var/lib/kubelet"`

	HostRootMountPath string `yaml:"hostRootMountPath"`

	Fields          Fields            `yaml:"fields"`    // Deprecated: use typePodFields
	K8sFields       map[string]string `yaml:"k8sFields"` // Deprecated: use typePodFields
	TypePodFields   KubeMetaFields    `yaml:"typePodFields"`
	TypeNodeFields  KubeMetaFields    `yaml:"typeNodeFields"`
	TypeVmFields    KubeMetaFields    `yaml:"typeVmFields"`
	FieldsOmitEmpty bool              `yaml:"fieldsOmitEmpty"`
	ParseStdout     bool              `yaml:"parseStdout"`

	Defaults Defaults `yaml:"defaults"`

	// If set to true, it means that the pipeline configuration generated does not contain specific Pod paths and meta information.
	// These data will be dynamically obtained by the file source, thereby reducing the number of configuration changes and reloads.
	DynamicContainerLog bool `yaml:"dynamicContainerLog"`

	VmMode bool `yaml:"vmMode"` // only for when Loggie running in Virtual Machine, and we use VM CRD as configurations
}

func (*Config) Validate added in v1.2.0

func (c *Config) Validate() error

type Controller

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

func NewController

func NewController(
	config *Config,
	kubeClientset kubernetes.Interface,
	logConfigClientset logconfigClientset.Interface,
	podInformer corev1Informers.PodInformer,
	logConfigInformer logconfigInformers.LogConfigInformer,
	clusterLogConfigInformer logconfigInformers.ClusterLogConfigInformer,
	sinkInformer logconfigInformers.SinkInformer,
	interceptorInformer logconfigInformers.InterceptorInformer,
	nodeInformer corev1Informers.NodeInformer,
	vmInformer logconfigInformers.VmInformer,
	runtime runtime.Runtime,
) *Controller

func (*Controller) InitK8sFieldsPattern added in v1.3.0

func (c *Controller) InitK8sFieldsPattern()

func (*Controller) Run

func (c *Controller) Run(stopCh <-chan struct{}, cacheSyncs ...cache.InformerSynced) error

type Defaults added in v1.5.0

type Defaults struct {
	SinkRef string `yaml:"sinkRef"`
}

type Element

type Element struct {
	Type         string `json:"type"` // resource type, eg: pod
	Key          string `json:"key"`  // MetaNamespaceKey, format: <namespace>/<name>
	SelectorType string `json:"selectorType"`
}

Element the item add to queue

type Fields

type Fields struct {
	NodeName      string `yaml:"node.name"`
	NodeIP        string `yaml:"node.ip"`
	Namespace     string `yaml:"namespace"`
	PodName       string `yaml:"pod.name"`
	PodIP         string `yaml:"pod.ip"`
	ContainerName string `yaml:"container.name"`
	LogConfig     string `yaml:"logConfig"`
}

Fields Deprecated

type KubeFileSourceExtra added in v1.3.0

type KubeFileSourceExtra struct {
	ContainerName            string         `yaml:"containerName,omitempty"`
	MatchFields              *matchFields   `yaml:"matchFields,omitempty"`
	TypePodFields            KubeMetaFields `yaml:"typePodFields,omitempty"`
	ExcludeContainerPatterns []string       `yaml:"excludeContainerPatterns,omitempty"` // regular pattern
	// contains filtered or unexported fields
}

func GetKubeExtraFromFileSource added in v1.3.0

func GetKubeExtraFromFileSource(src *source.Config) (*KubeFileSourceExtra, error)

func (*KubeFileSourceExtra) IsContainerExcluded added in v1.3.0

func (f *KubeFileSourceExtra) IsContainerExcluded(container string) bool

type KubeMetaFields added in v1.5.0

type KubeMetaFields map[string]string

type KubeTypeNodeExtra added in v1.5.0

type KubeTypeNodeExtra struct {
	TypeNodeFields KubeMetaFields `yaml:"typeNodeFields,omitempty"`
}

func GetKubeTypeNodeExtraSource added in v1.5.0

func GetKubeTypeNodeExtraSource(src *source.Config) (*KubeTypeNodeExtra, error)

Jump to

Keyboard shortcuts

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