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

[Elastic Agent] Fix issue with ensureServiceToken. #29800

Merged
merged 2 commits into from
Jan 12, 2022

Conversation

blakerouse
Copy link
Contributor

What does this PR do?

Fixes #29799.

It was always calling ensureServiceToken but that should only be done in the case that Fleet Server is enabled for the container.

Why is it important?

Otherwise its not possible to start the container without it trying to communicate with Kibana.

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • [ ] I have made corresponding changes to the documentation
  • [ ] I have made corresponding change to the default configuration files
  • [ ] I have added tests that prove my fix is effective or that my feature works
  • [ ] I have added an entry in CHANGELOG.next.asciidoc or CHANGELOG-developer.next.asciidoc.

How to test this PR locally

Build the container:

$ PLATFORMS="linux/amd64" mage dev:package
$ docker run -it docker.elastic.co/beats/elastic-agent:8.1.0

Related issues

@blakerouse blakerouse added the Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team label Jan 11, 2022
@blakerouse blakerouse self-assigned this Jan 11, 2022
@elasticmachine
Copy link
Collaborator

Pinging @elastic/elastic-agent-control-plane (Team:Elastic-Agent-Control-Plane)

@botelastic botelastic bot added needs_team Indicates that the issue/PR needs a Team:* label and removed needs_team Indicates that the issue/PR needs a Team:* label labels Jan 11, 2022
@blakerouse blakerouse added the backport-v8.0.0 Automated backport with mergify label Jan 11, 2022
return err
}
}
err = ensureServiceToken(streams, client, &cfg)
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't this move to the line 273? That way the call to kibanaSetup uses a service_token as well

@elasticmachine
Copy link
Collaborator

elasticmachine commented Jan 11, 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-12T14:47:12.961+0000

  • Duration: 102 min 35 sec

  • Commit: 3fc3ee3

Test stats 🧪

Test Results
Failed 0
Passed 7120
Skipped 16
Total 7136

💚 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!)

@blakerouse
Copy link
Contributor Author

@michel-laterman Your correct it would be better moved up. I also messed up the client change as well, add comment on why it needs to remain in the function.

Copy link
Contributor

@michel-laterman michel-laterman left a comment

Choose a reason for hiding this comment

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

lgtm, thanks for making the change!

@blakerouse
Copy link
Contributor Author

@adam-stokes Another Ansible failure, just so you know.

All tests pass, other than the failed ansible job.

@blakerouse blakerouse merged commit cb5f2eb into elastic:master Jan 12, 2022
@blakerouse blakerouse deleted the fix-29799 branch January 12, 2022 17:03
mergify bot pushed a commit that referenced this pull request Jan 12, 2022
* Fix issue with ensureServiceToken.

* Move ensureServiceToken up to line 273.

(cherry picked from commit cb5f2eb)
blakerouse added a commit that referenced this pull request Jan 12, 2022
* Fix issue with ensureServiceToken.

* Move ensureServiceToken up to line 273.

(cherry picked from commit cb5f2eb)

Co-authored-by: Blake Rouse <blake.rouse@elastic.co>
v1v added a commit to v1v/beats that referenced this pull request Jan 12, 2022
…b-for-macos

* upstream/master: (172 commits)
  [Elastic Agent] Fix issue with ensureServiceToken. (elastic#29800)
  [Winlogbeat] Add provider name to Security routing pipeline check (elastic#29781)
  Add summary to journeys which don't emit journey:end (early node subprocess exits) (elastic#29606)
  Prepare 8.0.0-rc1 changelog (elastic#29795) (elastic#29806)
  Change docker image from CentOS 7 to Ubuntu 20.04 (elastic#29681)
  libbeat/processors/add_process_metadata: implement a process cache eviction policy (elastic#29717)
  [Automation] Update elastic stack version to 8.1.0-7004acda for testing (elastic#29783)
  Missing changelog entry for elastic#29773 (elastic#29791)
  Add a readme for k8s autodiscover provider (elastic#28213)
  Remove overriding of index pattern on the Kubernetes overview dashboard (elastic#29676)
  jjbb: remove obsoleted branches (<7.16) (elastic#29707)
  Add k8s metadata in state_cronjob metricset (elastic#29572)
  ibmmq: Fix timestamp parsing (elastic#29773)
  Do not add date to index if `@meta.index` is set (elastic#29775)
  ci: uses aliases for the branches (elastic#29706)
  Filebeat tests: Restore `@timestamp` field validation (elastic#29772)
  Forward port 7.16.3 changelog to master (elastic#29777)
  auditd: Store program arguments in process.args array (elastic#29601)
  System/socket: Support kernel_clone() replacement for _do_fork() (elastic#29744)
  Do not mention removal if version is not specified in `cfgwarn` messages (elastic#29727)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-v8.0.0 Automated backport with mergify Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Elastic Agent] ensureServiceToken should not always be called for the container
3 participants