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

Allign k8s configuration settings #29908

Merged
merged 3 commits into from
Jan 24, 2022
Merged

Conversation

ChrsMark
Copy link
Member

What does this PR do?

This PR adds namespace and moves host to node settings under the kubernetes module.

Why is it important?

In order to have alignment between the metadata configurations.

Related issues

Closes #29132

Signed-off-by: chrismark <chrismarkou92@gmail.com>
@ChrsMark ChrsMark self-assigned this Jan 19, 2022
@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Jan 19, 2022
@ChrsMark ChrsMark added the Team:Integrations Label for the Integrations team label Jan 19, 2022
@elasticmachine
Copy link
Collaborator

Pinging @elastic/integrations (Team:Integrations)

@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Jan 19, 2022
@mergify
Copy link
Contributor

mergify bot commented Jan 19, 2022

This pull request does not have a backport label. Could you fix it @ChrsMark? 🙏
To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-v./d./d./d is the label to automatically backport to the 7./d branch. /d is the digit

NOTE: backport-skip has been added to this pull request.

@mergify mergify bot added the backport-skip Skip notification from the automated backport with mergify label Jan 19, 2022
@elasticmachine
Copy link
Collaborator

elasticmachine commented Jan 19, 2022

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2022-01-20T09:34:29.325+0000

  • Duration: 118 min 14 sec

  • Commit: b0ff4c5

Test stats 🧪

Test Results
Failed 0
Passed 47381
Skipped 4155
Total 51536

💚 Flaky test report

Tests succeeded.

🤖 GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

  • /package : Generate the packages and run the E2E tests.

  • /beats-tester : Run the installation tests with beats-tester.

  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

@ChrsMark
Copy link
Member Author

/package

@ChrsMark ChrsMark added the backport-v8.1.0 Automated backport with mergify label Jan 19, 2022
@mergify mergify bot removed the backport-skip Skip notification from the automated backport with mergify label Jan 19, 2022
@ChrsMark
Copy link
Member Author

Note to myself: add changelog entry before merging

Signed-off-by: chrismark <chrismarkou92@gmail.com>
@@ -29,7 +29,7 @@ import (
type kubeAnnotatorConfig struct {
KubeConfig string `config:"kube_config"`
KubeClientOptions kubernetes.KubeClientOptions `config:"kube_client_options"`
Host string `config:"host"`
Node string `config:"node"`
Copy link
Contributor

@tetianakravchenko tetianakravchenko Jan 20, 2022

Choose a reason for hiding this comment

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

should it first be deprecated instead of just dropping old setting name (the same as for autodiscover)? should it be considered a breaking change?
not sure what is the process here

Copy link
Member Author

@ChrsMark ChrsMark Jan 20, 2022

Choose a reason for hiding this comment

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

Actually it should be done like this the same time we did for autodiscover and processor. However we can claim that the change goes all the way with the k8s features and ship it under 8.1 as a breaking change which already had a notice. In any case this is was not set in any default manifests or configs so I don't forsee any huge impact.

@@ -51,12 +51,13 @@ type kubernetesConfig struct {
KubeConfig string `config:"kube_config"`
KubeClientOptions kubernetes.KubeClientOptions `config:"kube_client_options"`

Host string `config:"host"`
Node string `config:"node"`
Copy link
Contributor

Choose a reason for hiding this comment

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

the same question here

@@ -262,14 +263,15 @@ func getResourceMetadataWatchers(config *kubernetesConfig, resource kubernetes.R

options := kubernetes.WatchOptions{
SyncTimeout: config.SyncPeriod,
Namespace: config.Namespace,
Copy link
Contributor

Choose a reason for hiding this comment

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

should be added a check if config.Namespace is defined?

smth like here -

if config.Namespace != "" {
options.Namespace = config.Namespace
}

Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure if it really matters but I'm adding the check anyways. I would expect an empty value to have no impact.

Copy link
Contributor

@tetianakravchenko tetianakravchenko Jan 20, 2022

Choose a reason for hiding this comment

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

interesting why this check is added only for options that are used for nodeWatcher, but not for watcher (in autodiscover -

if config.Namespace != "" {
options.Namespace = config.Namespace
}
), maybe it is just a redundancy there. Anyway please let me know in case you figure it out. I am fine to keep it here as it is now

Copy link
Member Author

Choose a reason for hiding this comment

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

let me try to remove it and see what happens.

# If kube_config is not set, KUBECONFIG environment variable will be checked
# and if not present it will fall back to InCluster
#kube_config: ~/.kube/config
Copy link
Contributor

Choose a reason for hiding this comment

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

this setting is already defined in file - line 41, should be removed then

Signed-off-by: chrismark <chrismarkou92@gmail.com>
@ChrsMark
Copy link
Member Author

/package

@ChrsMark
Copy link
Member Author

@tetianakravchenko I think we are fine to remove the check for the namespace even e2e tests for beats passed. Could you have a final review on this?

Copy link
Contributor

@tetianakravchenko tetianakravchenko left a comment

Choose a reason for hiding this comment

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

LGTM!

@ChrsMark ChrsMark merged commit c1d4f28 into elastic:master Jan 24, 2022
yashtewari pushed a commit to build-security/beats that referenced this pull request Jan 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-v8.1.0 Automated backport with mergify Team:Integrations Label for the Integrations team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Align kubernetes module configuration
3 participants