Skip to content
This repository was archived by the owner on Sep 26, 2025. It is now read-only.

Commit 44e3e88

Browse files
authored
1.1.10 (#84)
1 parent e9c2fdf commit 44e3e88

File tree

8 files changed

+80
-35
lines changed

8 files changed

+80
-35
lines changed

.github/workflows/ci_build_test.yaml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88

99
jobs:
1010
build:
11-
runs-on: ubuntu-latest
11+
runs-on: ubuntu-20.04
1212
steps:
1313
- name: Checkout code
1414
uses: actions/checkout@v2
@@ -35,7 +35,7 @@ jobs:
3535
key: ${{ runner.os }}-build
3636

3737
unit-test:
38-
runs-on: ubuntu-latest
38+
runs-on: ubuntu-20.04
3939
needs:
4040
- build
4141
steps:
@@ -67,8 +67,9 @@ jobs:
6767
CI_INDEX_EVENTS: ci_events
6868
CI_INDEX_OBJECTS: ci_objects
6969
CI_INDEX_METRICS: ci_metrics
70-
KUBERNETES_VERSION: v1.15.2
71-
MINIKUBE_VERSION: v1.21.0
70+
KUBERNETES_VERSION: v1.23.2
71+
MINIKUBE_VERSION: v1.24.0
72+
MINIKUBE_NODE_COUNTS: 2
7273
GITHUB_ACTIONS: true
7374

7475
steps:
@@ -121,7 +122,7 @@ jobs:
121122
chmod +x minikube
122123
sudo mv minikube /usr/local/bin/
123124
# Start Minikube and Wait
124-
minikube start --driver=docker --container-runtime=docker --cpus 2 --memory 4096 --kubernetes-version=${KUBERNETES_VERSION} --no-vtx-check
125+
minikube start --driver=docker --container-runtime=docker --cpus 2 --memory 4096 --kubernetes-version=${KUBERNETES_VERSION} --no-vtx-check -n=${MINIKUBE_NODE_COUNTS}
125126
export JSONPATH='{range .items[*]}{@.metadata.name}:{range @.status.conditions[*]}{@.type}={@.status};{end}{end}'
126127
until kubectl get nodes -o jsonpath="$JSONPATH" 2>&1 | grep -q "Ready=True"; do
127128
sleep 1;
@@ -130,13 +131,15 @@ jobs:
130131
- name: Install Splunk
131132
run: |
132133
# Wait until minikube is ready
133-
kubectl apply -f https://docs.projectcalico.org/v3.14/manifests/calico.yaml
134134
export JSONPATH='{range .items[*]}{@.metadata.name}:{range @.status.conditions[*]}{@.type}={@.status};{end}{end}'
135135
until kubectl get nodes -o jsonpath="$JSONPATH" 2>&1 | grep -q "Ready=True"; do
136136
echo "wait for minikube ready ..."
137137
sleep 1;
138138
done
139139
kubectl get nodes
140+
until kubectl get sa | grep -q 'default'; do
141+
sleep 1;
142+
done
140143
# Install Splunk on minikube
141144
kubectl apply -f ci_scripts/k8s-splunk.yml
142145
# Wait until splunk is ready
@@ -189,4 +192,5 @@ jobs:
189192
--splunkd-url https://$CI_SPLUNK_HOST:8089 \
190193
--splunk-user admin \
191194
--splunk-password $CI_SPLUNK_PASSWORD \
192-
-p no:warnings -s
195+
--nodes-count $MINIKUBE_NODE_COUNTS\
196+
-p no:warnings -s -n auto

Gemfile.lock

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
fluent-plugin-kubernetes-objects (1.1.9)
4+
fluent-plugin-kubernetes-objects (1.1.10)
55
fluentd (>= 1.9.1)
66
http_parser.rb (= 0.5.3)
77
kubeclient (~> 4.6.0)
@@ -18,14 +18,14 @@ GEM
1818
docile (1.4.0)
1919
domain_name (0.5.20190701)
2020
unf (>= 0.0.5, < 1.0.0)
21-
ffi (1.15.4)
21+
ffi (1.15.5)
2222
ffi-compiler (1.0.1)
2323
ffi (>= 1.0.0)
2424
rake
25-
fluentd (1.14.2)
25+
fluentd (1.14.4)
2626
bundler
2727
cool.io (>= 1.4.5, < 2.0.0)
28-
http_parser.rb (>= 0.5.1, < 0.8.0)
28+
http_parser.rb (>= 0.5.1, < 0.9.0)
2929
msgpack (>= 1.3.1, < 2.0.0)
3030
serverengine (>= 2.2.2, < 3.0.0)
3131
sigdump (~> 0.2.2)
@@ -51,11 +51,11 @@ GEM
5151
http (>= 3.0, < 5.0)
5252
recursive-open-struct (~> 1.0, >= 1.0.4)
5353
rest-client (~> 2.0)
54-
mime-types (3.3.1)
54+
mime-types (3.4.1)
5555
mime-types-data (~> 3.2015)
56-
mime-types-data (3.2021.0901)
56+
mime-types-data (3.2022.0105)
5757
minitest (5.14.4)
58-
msgpack (1.4.2)
58+
msgpack (1.4.4)
5959
netrc (0.11.0)
6060
power_assert (2.0.1)
6161
public_suffix (4.0.6)
@@ -67,7 +67,7 @@ GEM
6767
mime-types (>= 1.16, < 4.0)
6868
netrc (~> 0.8)
6969
rexml (3.2.5)
70-
serverengine (2.2.4)
70+
serverengine (2.2.5)
7171
sigdump (~> 0.2.2)
7272
sigdump (0.2.4)
7373
simplecov (0.21.2)

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.1.9
1+
1.1.10

ci_scripts/deploy_connector.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@ helm install ci-sck --set global.splunk.hec.token=$CI_SPLUNK_HEC_TOKEN \
2525
--set splunk-kubernetes-objects.image.pullPolicy=IfNotPresent \
2626
--set splunk-kubernetes-objects.image.tag=recent \
2727
-f ci_scripts/sck_values.yml helm-chart/splunk-connect-for-kubernetes
28-
#wait for deployment to finish
29-
until kubectl get pod | grep Running | [[ $(wc -l) == 4 ]]; do
28+
29+
kubectl get pod
30+
# wait for deployment to finish
31+
# metric and logging deamon set for each node + aggr + object + splunk
32+
PODS=$((MINIKUBE_NODE_COUNTS*2+2+1))
33+
until kubectl get pod | grep Running | [[ $(wc -l) == $PODS ]]; do
3034
sleep 1;
3135
done

docker/Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,16 @@ COPY --from=builder /app/LICENSE /licenses/LICENSE
3333
RUN dnf install -y jq
3434

3535
COPY --from=builder /app/docker/Gemfile* ./
36+
RUN gem update date cgi
37+
RUN rm -f /usr/share/gems/specifications/default/cgi-0.1.0.gemspec /usr/share/gems/specifications/default/date-3.0.0.gemspec
3638
RUN yum update -y \
3739
&& yum remove -y nodejs npm \
3840
&& gem install bundler \
41+
&& gem uninstall -i /usr/share/gems bundler \
3942
&& gem unpack /tmp/*.gem --target gem \
4043
&& bundle install \
44+
&& bundle update i18n \
45+
&& gem uninstall -i /usr/share/gems i18n --version 1.8.11 \
4146
&& rpm -e --nodeps python3-pip-wheel python3-urllib3-* python3-requests-* python3-libxml2-* python3-dmidecode-* subscription-manager-* libwebp-* libwebp-devel-* glib2-* libjpeg-turbo-devel-* libjpeg-turbo-* mariadb-connector-c-config-* mariadb-connector-c-* mariadb-connector-c-devel-* rsync-* sqlite-libs-* sqlite-devel-* sqlite-* libxml2-* libxml2-devel-* libX11-* libX11-common-* libX11-devel-* libX11-xcb-* nettle-* libsolv-* file-libs-* dbus-daemon-* tar-* qt5-srpm-macros-* perl-parent-* git-* bsdtar-* openssh-clients-* json-c-* binutils-* libtiff-devel-* libtiff-* || true
4247

4348
RUN groupadd -r $FLUENT_USER && \

docker/Gemfile.lock

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: gem
33
specs:
4-
fluent-plugin-kubernetes-objects (1.1.9)
4+
fluent-plugin-kubernetes-objects (1.1.10)
55
fluentd (>= 1.9.1)
66
http_parser.rb (= 0.5.3)
77
kubeclient (~> 4.6.0)
@@ -43,7 +43,7 @@ GEM
4343
prometheus-client (>= 2.1.0)
4444
fluent-plugin-record-modifier (2.1.0)
4545
fluentd (>= 1.0, < 2)
46-
fluent-plugin-splunk-hec (1.2.9)
46+
fluent-plugin-splunk-hec (1.2.11)
4747
fluentd (>= 1.4)
4848
multi_json (~> 1.13)
4949
net-http-persistent (~> 3.1)
@@ -150,7 +150,6 @@ GEM
150150
httpclient (>= 2.4)
151151
webrick (1.7.0)
152152
yajl-ruby (1.4.1)
153-
zeitwerk (2.5.1)
154153

155154
PLATFORMS
156155
ruby

lib/fluent/plugin/in_kubernetes_objects.rb

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,12 @@ def create_pull_thread(conf)
200200
tag = generate_tag resource_name
201201
while thread_current_running?
202202
log.debug "Going to pull #{resource_name}"
203-
response = @client.public_send "get_#{resource_name}", options
203+
begin
204+
response = @client.public_send "get_#{resource_name}", options
205+
rescue Kubeclient::ResourceNotFoundError, NoMethodError
206+
log.error "resource '#{resource_name}' not found. Stopped pulling it"
207+
break
208+
end
204209
now = Fluent::Engine.now
205210
es = Fluent::MultiEventStream.new
206211

@@ -243,22 +248,27 @@ def create_watcher_thread(conf)
243248

244249
thread_create :"watch_#{resource_name}" do
245250
while thread_current_running?
246-
@client.public_send("watch_#{resource_name}", options).tap do |watcher|
247-
tag = generate_tag "#{resource_name}"
248-
begin
249-
watcher.each do |entity|
250-
begin
251-
entity = JSON.parse(entity)
252-
router.emit tag, Fluent::Engine.now, entity
253-
options[:resource_version] = entity['object']['metadata']['resourceVersion']
254-
@storage.put resource_name, entity['object']['metadata']['resourceVersion']
255-
rescue => e
256-
log.info "Got exception #{e} parsing entity #{entity}. Resetting watcher."
251+
begin
252+
@client.public_send("watch_#{resource_name}", options).tap do |watcher|
253+
tag = generate_tag "#{resource_name}"
254+
begin
255+
watcher.each do |entity|
256+
begin
257+
entity = JSON.parse(entity)
258+
router.emit tag, Fluent::Engine.now, entity
259+
options[:resource_version] = entity['object']['metadata']['resourceVersion']
260+
@storage.put resource_name, entity['object']['metadata']['resourceVersion']
261+
rescue => e
262+
log.info "Got exception #{e} parsing entity #{entity}. Resetting watcher."
263+
end
257264
end
265+
rescue => e
266+
log.info "Got exception #{e}. Resetting watcher."
258267
end
259-
rescue => e
260-
log.info "Got exception #{e}. Resetting watcher."
261268
end
269+
rescue Kubeclient::ResourceNotFoundError, NoMethodError
270+
log.error "resource '#{resource_name}' not found. Stopped watching it"
271+
break
262272
end
263273
end
264274
end

test/fluent/plugin/in_kubernetes_objects_test.rb

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,5 +144,28 @@
144144
f.unlink
145145
end
146146
end
147+
it "checks for invalid pull request" do
148+
d = create_input_driver(<<~CONF)
149+
kubernetes_url #{k8s_url}
150+
<pull>
151+
resource_name fakeResource
152+
</pull>
153+
CONF
154+
155+
d.run expect_emits: 0, timeout: 3
156+
157+
expect(d.logs.any? { |log| log.include? "resource 'fakeResource' not found." }).must_equal(true)
158+
end
159+
it "checks for invalid watch request" do
160+
d = create_input_driver(<<~CONF)
161+
kubernetes_url #{k8s_url}
162+
<watch>
163+
resource_name fakeResource
164+
</watch>
165+
CONF
166+
167+
d.run expect_emits: 0, timeout: 3
168+
expect(d.logs.any? { |log| log.include? "resource 'fakeResource' not found." }).must_equal(true)
169+
end
147170
end
148171
end

0 commit comments

Comments
 (0)