[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

⚡ k8s event logger operator - logs configured events to stdout in order to not lose them

License

Notifications You must be signed in to change notification settings

bakito/k8s-event-logger-operator

Repository files navigation

Go e2e Go Report Card

GitHub Release Coverage Status

k8s event logger operator

This operator creates a logging pod that logs corev1.Event information as structured json log. The crd allows to configure the events to be logged.

Installation

Operator

The operator is insalled with helm.

helm upgrade --install eventlogger ./helm/

Custom Resource Definition (CRD)

apiVersion: eventlogger.bakito.ch/v1
kind: EventLogger
metadata:
  name: example-eventlogger
spec:
  kinds:
    - name: DeploymentConfig # the kind of the event source to be logged
      apiGroup: apps.openshift.io # optional
      eventTypes: # optional
        - Normal
        - Warning
      reasons: # optional
        - DeploymentCreated
        - ReplicationControllerScaled
      skipReasons: # optional
        - Unhealthy
      matchingPatterns: # optional - regexp pattern to match event messages
        - .*
      skipOnMatch: false # optional - skip events where messages match the pattern. Default false


  eventTypes: # optional - define the event types to log. If no types are defined, all events are logged
    - Normal
    - Warning

  labels: # optional - additional labels for the pod
    name: value

  annotations: # optional - additional annotations for the pod
    name: value

  scrapeMetrics: false # optional att prometheus scrape metrics annotation to the pod. Default false

  namespace: "ns" # optional - the namespace to listen the events on. Default the current namespace

  nodeSelector: # optional - a node selector for the logging pod.
    key: value

  serviceAccount: "sa" # optional - if a custom ServiceAccount should be used for the pod. Default ServiceAccount is automatically created

  ImagePullSecrets: # optional - list of references to secrets to use for pulling the image.
    - name: name

  logFields: # optional - map if custom log field names. Key then log field name / Value: the reflection fields to the value within the struct corev1.Event https://github.com/kubernetes/api/blob/master/core/v1/types.go
    - name: name
      path:
        - InvolvedObject
        - Name
    - name: kind
      path:
        - InvolvedObject
        - Kind
    - name: type
      path:
        - Type
    - name: some-static-value
      value: ""