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

plugin scaffold #30

Merged
merged 1 commit into from
May 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions fluent-plugin-enhance-k8s-metadata/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source "https://rubygems.org"

gemspec
41 changes: 41 additions & 0 deletions fluent-plugin-enhance-k8s-metadata/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# fluent-plugin-enhance-k8s-metadata

[Fluentd](https://fluentd.org/) output plugin to add extra Kubernetes metadata to the events.

- Sample of Input

```json
TBD
```

- Sample of Output

```json
TBD
```

## Installation

### RubyGems

```sh
gem install fluent-plugin-enhance-k8s-metadata
```

### Bundler

Add following line to your Gemfile:

```ruby
gem "fluent-plugin-enhance-k8s-metadata"
```

And then execute:

```sh
bundle
```

## Configuration

TBD
13 changes: 13 additions & 0 deletions fluent-plugin-enhance-k8s-metadata/Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
require "bundler"
Bundler::GemHelper.install_tasks

require "rake/testtask"

Rake::TestTask.new(:test) do |t|
t.libs.push("lib", "test")
t.test_files = FileList["test/**/test_*.rb"]
t.verbose = true
t.warning = true
end

task default: [:test]
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
lib = File.expand_path("../lib", __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)

Gem::Specification.new do |spec|
spec.name = "fluent-plugin-enhance-k8s-metadata"
spec.version = "0.0.0"
spec.authors = ["Sumo Logic"]
spec.email = ["collection@sumologic.com"]

spec.summary = "Fluentd plugin for appending extra metadata from Kubernetes."
spec.homepage = "https://github.com/SumoLogic/sumologic-kubernetes-collection"
spec.license = "Apache-2.0"

test_files, files = `git ls-files -z`.split("\x0").partition do |f|
f.match(%r{^(test|spec|features)/})
end
spec.files = files
spec.executables = files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.test_files = test_files
spec.require_paths = ["lib"]

spec.add_development_dependency "bundler", "~> 2.0"
spec.add_development_dependency "rake", "~> 12.0"
spec.add_development_dependency "test-unit", "~> 3.0"
spec.add_runtime_dependency "fluentd", [">= 0.14.10", "< 2"]
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
require 'fluent/plugin/filter'

module Fluent
module Plugin
# fluentd filter plugin for appending Kubernetes metadata to events
class EnhanceK8sMetadataFilter < Fluent::Plugin::Filter
Fluent::Plugin.register_filter('enhance_k8s_metadata', self)

def filter(tag, time, record)
end
end
end
end
8 changes: 8 additions & 0 deletions fluent-plugin-enhance-k8s-metadata/test/helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
$LOAD_PATH.unshift(File.expand_path("../../", __FILE__))
require "test-unit"
require "fluent/test"
require "fluent/test/driver/filter"
require "fluent/test/helpers"

Test::Unit::TestCase.include(Fluent::Test::Helpers)
Test::Unit::TestCase.extend(Fluent::Test::Helpers)
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
require "helper"
require "fluent/plugin/filter_enhance_k8s_metadata.rb"

class EnhanceK8sMetadataFilterTest < Test::Unit::TestCase
setup do
Fluent::Test.setup
end

private

def create_driver(conf)
Fluent::Test::Driver::Filter.new(Fluent::Plugin::EnhanceK8sMetadataFilter).configure(conf)
end
end