Skip to content

helm: define headless service for statefulset presets #8949

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

Conversation

pkoutsovasilis
Copy link
Contributor

@pkoutsovasilis pkoutsovasilis commented Jul 11, 2025

What does this PR do?

This PR adds support for deploying Elastic Agent using StatefulSet by properly defining a serviceName, as required by the Kubernetes specification for StatefulSets.

Specifically, it:

  • Introduces a headless service (clusterIP: None) per preset when mode: statefulset is used.
  • Sets the serviceName field in the StatefulSet template to refer to the respective headless service.
  • Provides a working example under examples/statefulset-preset/ showcasing a NetFlow integration running as a StatefulSet.

Why is it important?

StatefulSets in Kubernetes require the serviceName field to be specified to ensure stable network identities and persistent storage for each replica.

Checklist

  • I have read and understood the pull request guidelines of this project.
  • 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

None. This is an additive change that only affects users opting into StatefulSet mode. Existing other mode-based presets are unaffected.

How to test this PR locally

mage helm:renderExamples

Related issues

@pkoutsovasilis pkoutsovasilis self-assigned this Jul 11, 2025
@pkoutsovasilis pkoutsovasilis added bug Something isn't working skip-changelog backport-8.18 Automated backport to the 8.18 branch backport-9.0 Automated backport to the 9.0 branch backport-8.19 Automated backport to the 8.19 branch backport-9.1 Automated backport to the 9.1 branch labels Jul 11, 2025
@elasticmachine
Copy link
Collaborator

elasticmachine commented Jul 11, 2025

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

@pkoutsovasilis pkoutsovasilis marked this pull request as ready for review July 11, 2025 07:27
@pkoutsovasilis pkoutsovasilis requested a review from a team as a code owner July 11, 2025 07:27
Copy link
Member

@pchila pchila left a comment

Choose a reason for hiding this comment

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

LGTM

@pkoutsovasilis pkoutsovasilis merged commit 380c944 into elastic:main Jul 15, 2025
26 checks passed
mergify bot pushed a commit that referenced this pull request Jul 15, 2025
mergify bot pushed a commit that referenced this pull request Jul 15, 2025
mergify bot pushed a commit that referenced this pull request Jul 15, 2025
mergify bot pushed a commit that referenced this pull request Jul 15, 2025
pkoutsovasilis added a commit that referenced this pull request Jul 15, 2025
…resets (#9011)

* fix: define a headless service for statefulset presets (#8949)

(cherry picked from commit 380c944)

* fix: render helm chart examples

---------

Co-authored-by: Panos Koutsovasilis <[email protected]>
pkoutsovasilis added a commit that referenced this pull request Jul 15, 2025
…presets (#9009)

* fix: define a headless service for statefulset presets (#8949)

(cherry picked from commit 380c944)

* fix: render helm chart examples

---------

Co-authored-by: Panos Koutsovasilis <[email protected]>
pkoutsovasilis added a commit that referenced this pull request Jul 15, 2025
…presets (#9012)

* fix: define a headless service for statefulset presets (#8949)

(cherry picked from commit 380c944)

* fix: render helm chart examples

---------

Co-authored-by: Panos Koutsovasilis <[email protected]>
pkoutsovasilis added a commit that referenced this pull request Jul 15, 2025
… presets (#9010)

* fix: define a headless service for statefulset presets (#8949)

(cherry picked from commit 380c944)

* fix: render helm chart examples

---------

Co-authored-by: Panos Koutsovasilis <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-8.18 Automated backport to the 8.18 branch backport-8.19 Automated backport to the 8.19 branch backport-9.0 Automated backport to the 9.0 branch backport-9.1 Automated backport to the 9.1 branch bug Something isn't working skip-changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants