-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
filter_kubernetes: Support config of endpoint path in Kube_URL. #2265
Open
jimwrightcz
wants to merge
1
commit into
fluent:master
Choose a base branch
from
jimwrightcz:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The motivation is to make it possible to test config against a rancher cluster before deployment. Also fix a bug that the default port is only correct for the default protocol i.e. HTTPS but also used incorrectly when Kube_URL is configured with http: and no port. RFC-1738 dictates that the port is 80 in that case. On the other hand, for backward compatibility the same default path is applied if none is specified. If you really want none then specify the root /. In other cases a trailing / is ignored and always inserted when the URL is used later. The default path is extracted to FLB_KUBE_API_PATH. Similar constants are now only defined in kube_conf.h, Unused duplicates in kube_meta.h have been removed but the names were better so now used kube_conf.h. Signed-off-by: Jim Wright <[email protected]>
Example config
e.g. if you are using: |
Debug and valgrind output: ==26978== Memcheck, a memory error detector
==26978== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==26978== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info
==26978== Command: /home/local/MGM/jwright/git/fluent-bit/build/bin/fluent-bit --config=/tmp/test.sh-26951-conf
==26978==
�[1mFluent Bit v1.5.0�[0m
* �[1m�[93mCopyright (C) 2019-2020 The Fluent Bit Authors�[0m
* �[1m�[93mCopyright (C) 2015-2018 Treasure Data�[0m
* Fluent Bit is a CNCF sub-project under the umbrella of Fluentd
* https://fluentbit.io
[2020/06/15 15:31:35] [ info] Configuration:
[2020/06/15 15:31:35] [ info] flush time | 1.000000 seconds
[2020/06/15 15:31:35] [ info] grace | 5 seconds
[2020/06/15 15:31:35] [ info] daemon | 0
[2020/06/15 15:31:35] [ info] ___________
[2020/06/15 15:31:35] [ info] inputs:
[2020/06/15 15:31:35] [ info] forward
[2020/06/15 15:31:35] [ info] ___________
[2020/06/15 15:31:35] [ info] filters:
[2020/06/15 15:31:35] [ info] kubernetes.0
[2020/06/15 15:31:35] [ info] ___________
[2020/06/15 15:31:35] [ info] outputs:
[2020/06/15 15:31:35] [ info] stdout.0
[2020/06/15 15:31:35] [ info] ___________
[2020/06/15 15:31:35] [ info] collectors:
[2020/06/15 15:31:36] [debug] [storage] [cio stream] new stream registered: forward.0
[2020/06/15 15:31:36] [ info] [storage] version=1.0.4, initializing...
[2020/06/15 15:31:36] [ info] [storage] in-memory
[2020/06/15 15:31:36] [ info] [storage] normal synchronization mode, checksum disabled, max_chunks_up=128
[2020/06/15 15:31:36] [ info] [engine] started (pid=26978)
[2020/06/15 15:31:36] [debug] [engine] coroutine stack size: 24576 bytes (24.0K)
[2020/06/15 15:31:36] [debug] [in_fw] Listen='0.0.0.0' TCP_Port=24224
[2020/06/15 15:31:36] [ info] [input:forward:forward.0] listening on 0.0.0.0:24224
[2020/06/15 15:31:36] [debug] [filter:kubernetes:kubernetes.0] Kube API endpoint http://127.0.0.1:80/k8s/clusters/c-45qm6/api/v1/
[2020/06/15 15:31:36] [ info] [filter:kubernetes:kubernetes.0] https=0 host=127.0.0.1 port=80
[2020/06/15 15:31:36] [ warn] [filter:kubernetes:kubernetes.0] cannot open /var/run/secrets/kubernetes.io/serviceaccount/namespace
[2020/06/15 15:31:36] [ info] [filter:kubernetes:kubernetes.0] Fluent Bit not running in a POD
[2020/06/15 15:31:36] [debug] [router] match rule forward.0:stdout.0
[2020/06/15 15:31:36] [ info] [sp] stream processor started
==26978== Warning: client switching stacks? SP change: 0xffeffff78 --> 0x5be91f0
==26978== to suppress, use: --max-stackframe=68606324104 or greater
==26978== Warning: client switching stacks? SP change: 0x5be9168 --> 0xffeffff78
==26978== to suppress, use: --max-stackframe=68606324240 or greater
==26978== Warning: client switching stacks? SP change: 0xffeffff78 --> 0x5be9168
==26978== to suppress, use: --max-stackframe=68606324240 or greater
==26978== further instances of this message will not be shown.
[2020/06/15 15:31:36] [debug] [http_client] server 127.0.0.1:80 will close connection #21
[2020/06/15 15:31:36] [debug] [filter:kubernetes:kubernetes.0] API Server (ns=some_namespace, pod=tomcat-5c97498576-9bp8j) http_do=0, HTTP Status: 200
[2020/06/15 15:31:36] [debug] [task] created task=0x5be2db0 id=0 OK
[2020/06/15 15:31:36] [debug] [task] destroy task=0x5be2db0 (task_id=0)
[engine] caught signal (SIGTERM)
[2020/06/15 15:31:41] [ warn] [engine] service will stop in 5 seconds
[2020/06/15 15:31:45] [ info] [engine] service stopped
==26978==
==26978== HEAP SUMMARY:
==26978== in use at exit: 0 bytes in 0 blocks
==26978== total heap usage: 619 allocs, 619 frees, 957,799 bytes allocated
==26978==
==26978== All heap blocks were freed -- no leaks are possible
==26978==
==26978== For counts of detected and suppressed errors, rerun with: -v
==26978== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) |
This PR is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 10 days. |
This PR is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 10 days. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The motivation is to make it possible to test config against a rancher cluster
before deployment.
Also fix a bug that the default port is only correct for the default protocol
i.e. HTTPS but also used incorrectly when Kube_URL is configured with http: and
no port. RFC-1738 dictates that the port is 80 in that case.
On the other hand, for backward compatibility the same default path is applied
if none is specified. If you really want none then specify the root /. In other
cases a trailing / is ignored and always inserted when the URL is used later.
The default path is extracted to FLB_KUBE_API_PATH. Similar constants are now
only defined in kube_conf.h, Unused duplicates in kube_meta.h have been removed
but the names were better so now used kube_conf.h.
Signed-off-by: Jim Wright [email protected]
None AFAIK but it is possible someone reported the port issue as a bug.
Enter
[N/A]
in the box, if an item is not applicable to your change.Testing
Before we can approve your change; please submit the following in a comment:
Documentation
Fluent Bit is licensed under Apache 2.0, by submitting this pull request I understand that this code will be released under the terms of that license.