-
Notifications
You must be signed in to change notification settings - Fork 148
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
[Hints Support] Add default host #3575
Conversation
This pull request does not have a backport label. Could you fix it @constanca-m? 🙏
NOTE: |
🌐 Coverage report
|
/test |
}, | ||
"enabled": true, | ||
"host": "127.0.0.5:6379", | ||
"stream": "stderr", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need the stream here? If not shall we remove it from all tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need it, I just wanted to make sure that adding the default host was not overwriting any of the hints.
@constanca-m you should create a fragment to pass the CI failure. elastic-agent-changelog-tool new <some title> |
I think in the description the term "pod" is mixed with the term "container". For example |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice addition!
I have left some comments to consider as improvements. I have not tested the patch manually but maybe it would worth it to introduce some manual testing phase for such PRs (since it seems that e2e is not used any more?).
Pinging @elastic/elastic-agent (Team:Elastic-Agent) |
SonarQube Quality Gate |
What does this PR do?
Given a pod with containers, it adds
co.elastic.hints.<container-name>/host: '${kubernetes.pod.ip}:<container-port>'
to the annotations for each container.Why is it important?
The user no longer needs to specify the host for the hints, which until now was a mandatory step.
Checklist
./changelog/fragments
using the changelog toolHow to test this PR locally
co.elastic.hints/package
and check if the results can be seen in ES.Related issues
host
in hints autodiscovery by using proper default values #1453Results
Context: We have a nginx container with two pods: one in port 80,
nginx-1
, and another in port 81,nginx-2
.The manifest file for that would be something like this.
Situation 1: Two pods and no annotation for host
If we have annotations only for the package:
Then the defaults for the
host
will be used.Inspecting the output of the inspect command (
elastic-agent inspect -v --variables --variables-wait 2s
) results in this:Checking the unique count of the containers has this output:
Situation 2: Two pods and only one host annotation for one pod
The annotations would be like this:
The result is the same as situation 1, as the host for
nginx-2
will be the default ('${kubernetes.pod.ip}:
+port
).Situation 3: Two pods and one top level annotation
The annotations would be like this:
In this case, we are using a port that is not even possible (there is no nginx pod with port 82), to make sure the host works.
The output is the exact same as situation 1. The following happened in our code: