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

[helm] fleet mode fixes #6345

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

pkoutsovasilis
Copy link
Contributor

@pkoutsovasilis pkoutsovasilis commented Dec 16, 2024

What does this PR do?

This PR introduces several fixes to the Elastic Agent Helm chart regarding Fleet Mode deployments:

  • Fleet mode now includes the necessary Kubernetes changes (e.g., volume mounts, resource requests) for enabled integrations.
  • Leader election is enabled by default for Fleet mode unless explicitly disabled by the user in the agent preset.
  • Kubernetes integration is now enabled by default.
  • Sets hostNetwork=true for perNode (Daemonset) agent preset, used by kubernetes and system integrations

Why is it important?

These changes are critical as they address bugs 🙂

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/fragments using the changelog tool
  • [ ] I have added an integration test or an E2E test

Disruptive User Impact

N/A

How to test this PR locally

Related issues

@pkoutsovasilis pkoutsovasilis added Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team skip-changelog backport-8.x Automated backport to the 8.x branch with mergify backport-8.17 Automated backport with mergify labels Dec 16, 2024
@pkoutsovasilis pkoutsovasilis self-assigned this Dec 16, 2024
@pkoutsovasilis pkoutsovasilis force-pushed the helm/fix_fleet_k8s_mounts branch from 81e13d6 to 53b7cc1 Compare December 18, 2024 16:21
@pkoutsovasilis
Copy link
Contributor Author

/test

@pkoutsovasilis pkoutsovasilis force-pushed the helm/fix_fleet_k8s_mounts branch from 53b7cc1 to a3ad6c7 Compare December 18, 2024 19:33
@pkoutsovasilis
Copy link
Contributor Author

buildkite test this

@pkoutsovasilis pkoutsovasilis marked this pull request as ready for review December 19, 2024 13:36
@pkoutsovasilis pkoutsovasilis requested a review from a team as a code owner December 19, 2024 13:36
@elasticmachine
Copy link
Contributor

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

@pkoutsovasilis
Copy link
Contributor Author

cc @eedugon in case you wanna give this PR a go before it gets merged 🙂

Copy link
Contributor

@blakerouse blakerouse left a comment

Choose a reason for hiding this comment

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

lgtm!

@eedugon
Copy link
Contributor

eedugon commented Dec 19, 2024

I'll give it a try!

Copy link
Contributor

mergify bot commented Dec 19, 2024

This pull request is now in conflicts. Could you fix it? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

git fetch upstream
git checkout -b helm/fix_fleet_k8s_mounts upstream/helm/fix_fleet_k8s_mounts
git merge upstream/main
git push upstream helm/fix_fleet_k8s_mounts

@pkoutsovasilis pkoutsovasilis added the backport-8.16 Automated backport with mergify label Dec 19, 2024
…unts

# Conflicts:
#	deploy/helm/elastic-agent/examples/kubernetes-hints-autodiscover/rendered/manifest.yaml
#	deploy/helm/elastic-agent/examples/multiple-integrations/rendered/manifest.yaml
#	deploy/helm/elastic-agent/templates/integrations/_kubernetes/_preset_pernode.tpl
Copy link

Quality Gate passed Quality Gate passed

Issues
0 New issues
0 Fixed issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarQube

@eedugon
Copy link
Contributor

eedugon commented Dec 20, 2024

@pkoutsovasilis : I've tried to test the PR. It looks promising and I think everything is fixed, however I've found a problem.

From your branch I have run the following:

helm upgrade --install demo5 ./deploy/helm/elastic-agent \
--set agent.fleet.enabled=true \
--set agent.fleet.url=https://fleet-svc.default.svc:443 \
--set agent.fleet.token=MVpCSXRwTUJEWE90bU9YWVh6dmg6ekhDV0lna3FRaUM2SUhTRGg2UUpNZw== \
--set agent.fleet.preset=perNode \
--set agent.version=8.16.2 \
--set agent.fleet.insecure=true

Note: I have to set agent.version=8.16.2 because my stack is in that version.
The manifest and installed agent runs 9.x.x:

        image: docker.elastic.co/beats/elastic-agent:9.0.0-SNAPSHOT

So it looks the parameter agent.version is ignored.

Besides that, the generated manifest looks OK, and I would expect it to solve the issues of the PR:

  • HostPath volume mounts for logs look ok.
  • HostNetwork looks ok
  • Leader election looks ok.

Thanks for this!

@eedugon eedugon self-requested a review December 20, 2024 08:19
Copy link
Contributor

@eedugon eedugon left a comment

Choose a reason for hiding this comment

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

LGTM, check out the comment about agent.version just in case (not related with this PR though).

@pkoutsovasilis
Copy link
Contributor Author

pkoutsovasilis commented Dec 20, 2024

LGTM, check out the comment about agent.version just in case (not related with this PR though).

thanks for the testing @eedugon , the value to change the tag of the agent image is agent.image.tag; agent.version was used when the user enabled hints, to find and download the correct released archive. That said, since these got embedded in the agent container image maybe it is time to deprecate it 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-8.x Automated backport to the 8.x branch with mergify backport-8.16 Automated backport with mergify backport-8.17 Automated backport with mergify skip-changelog Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team
Projects
None yet
4 participants