Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Events plugin #35

Merged
merged 16 commits into from
Jun 4, 2019
Merged

Events plugin #35

merged 16 commits into from
Jun 4, 2019

Conversation

maimaisie
Copy link
Contributor

@maimaisie maimaisie commented May 31, 2019

This PR adds the event plugin to collect k8s events from the API server. To start the events deployment, run

kubectl -n sumologic create secret generic sumologic --from-literal=endpoint-events=<events-http-source-url>
kubectl apply -f deploy/kubernetes/fluentd-sumologic-events.yaml

We will need to move everything in this yaml file to the existing file fluentd-sumologic.yaml once everything has finalized, in a separate PR.

This diagram shows the flow of the plugin:
Design Document - Kubernetes Events Ingestion

Currently I am duplicating connector.rb (connects to kubeclient) that @bin3377 wrote in the enhance-k8s-metadata plugin. We will refactor it later.

FYI @lei-sumo @samjsong @rvmiller89

Copy link
Contributor

@yuting-liu yuting-liu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -0,0 +1,202 @@

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't need a LICENSE for each plugin, so it can be removed

if (!@resource_version)
@resource_version = 0
sleep(5)
start_watcher_thread
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If my understanding correctly, you want to restart a watcher if something get wrong, but that should also handle the exceptions like invalid JSON or parsing failure?
And on the other side, the watcher restart in another thread, may cause thread leaking? (like different threads start multiple watcher?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that should also handle the exceptions like invalid JSON or parsing failure?

This is a good point. I will add some exception handling for invalid JSON and parsing failure after we receive each event. What should we do in case of that? Should we just log the exception/error and skip the event we can't parse and move on?

the watcher restart in another thread, may cause thread leaking? (like different threads start multiple watcher?

After the current thread calls start_watcher_thread here, it breaks out of the watch loop and finishes executing its block of code. I think at this point this thread is considered completed and not running.

@maimaisie maimaisie merged commit 24d7af4 into master Jun 4, 2019
@maimaisie maimaisie deleted the maisie-events-poc branch June 4, 2019 20:54
psaia pushed a commit to psaia/sumologic-kubernetes-collection that referenced this pull request May 25, 2021
* Write terraform resource reference for collector_ids and role_ids

* Only get the role names once and before beginning to write to the config file

* Fix how roles are written to file

* Add roles files output from script to gitignore

* Add script that imports resources into terraform

* Add docstrings to functions

* Add new line

* Fix return type for function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants