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

SUMO-113170 Support different k8s api versions #74

Merged
merged 8 commits into from Jul 18, 2019

Conversation

yuting-liu
Copy link
Contributor

  • Add support for different k8S api versions with multiple clients.
  • Add unit tests.

@yuting-liu
Copy link
Contributor Author

ci/build.sh successfully run on my machine locally but seems failed here. Will investigate it.

Copy link
Contributor

@maimaisie maimaisie left a comment

Choose a reason for hiding this comment

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

If you haven't, let's make sure to run the plugin with the beta1 api version and check if events are getting ingested to Sumo. I feel like because we are stubbing all client methods in the unit tests, we are not really testing the logic "given a different API version it will call different endpoint". Technically, if you set beta1 version in the config param in a unit test and call mock_get_events with the v1 file, it would still succeed

fluent-plugin-events/lib/sumologic/kubernetes/connector.rb Outdated Show resolved Hide resolved
samjsong
samjsong previously approved these changes Jul 16, 2019
Copy link
Contributor

@samjsong samjsong left a comment

Choose a reason for hiding this comment

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

LGTM with one minor comment. +1 to Maisie's comment that we should try testing to see how it works when deployed

fluent-plugin-events/test/helper.rb Outdated Show resolved Hide resolved
@yuting-liu
Copy link
Contributor Author

yuting-liu commented Jul 18, 2019

Already tested the plugin, with api version apps/v1 and resourceName deployments.
We do get both log lines that there are two clients created, one for v1, the other for apps/v1:

create client with URL: https://XX.XX.X.X:XXX/api and apiVersion: v1
create client with URL: https://XX.XX.X.X:XXX/apis and apiVersion: apps/v1

Here is what we got from watch:

{  
   "type":"ADDED",
   "object":{  
      "kind":"Deployment",
      "apiVersion":"apps/v1",
      "metadata":{  
         "name":"fluentd-events",
         "namespace":"sumologic",
         "selfLink":"/apis/apps/v1/namespaces/sumologic/deployments/fluentd-events",
         "uid":"64720983-a984-11e9-80e5-025000000001",
         "resourceVersion":"2771498",
         "generation":1,
         "creationTimestamp":"2019-07-18T17:49:29Z",
         "labels":{  
            "k8s-app":"fluentd-sumologic"
         },
         ...
}

So this do watch the correct resource with correct api version.

@maimaisie
Copy link
Contributor

is this log ingested in Sumo?

@yuting-liu
Copy link
Contributor Author

@maimaisie Yea, the log is ingested in Sumo.

@yuting-liu yuting-liu merged commit 9ea9984 into master Jul 18, 2019
@yuting-liu yuting-liu deleted the yuting-multiple-version branch July 18, 2019 20:34
psaia pushed a commit to psaia/sumologic-kubernetes-collection that referenced this pull request May 25, 2021
* Remove hard coded enable_ad

* Enable ad

* Format
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.

None yet

3 participants