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

Add ServiceMonitor support to Telegraf chart #706

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Idanbunimovich
Copy link

PR: Add ServiceMonitor Support and LoadBalancerIP Option
Overview
This pull request introduces two enhancements to the official Telegraf Helm chart:

ServiceMonitor Support:
A new template has been added to create a ServiceMonitor resource for Prometheus Operator integration. This enables users to automatically have their Telegraf metrics scraped by Prometheus.

LoadBalancerIP Option:
An optional parameter has been added to the Service template. When the service type is set to LoadBalancer and a loadBalancerIP is provided in the values, this IP will be assigned to the Service. This allows users to reserve a static IP address for their LoadBalancer.

Details
ServiceMonitor Enhancements
Template Addition:
A new template (servicemonitor.yml) has been added that conditionally creates a ServiceMonitor resource if serviceMonitor.enabled is set to true in the values file.

Configuration Options:
Users can now configure the ServiceMonitor with the following options in their values.yaml:

serviceMonitor:
enabled: true # Set to true to enable ServiceMonitor creation
interval: "10s" # Scrape interval for Prometheus
labels:
team: "frontend" # Custom labels (optional)
Compatibility:
This change is backward compatible. If serviceMonitor.enabled is not set or is false, the chart behaves as before.

LoadBalancerIP Support
Template Update:
The Service template has been updated to conditionally include the loadBalancerIP field when:

The service type is set to LoadBalancer
A loadBalancerIP is provided in the values file
Configuration Option:
To use this feature, users can update their values.yaml as follows:

service:
type: LoadBalancer

Uncomment and set to your desired static IP if using LoadBalancer

loadBalancerIP: "1.2.3.4"
Outcome:
This ensures that when a static IP is required, it will be applied to the Service, while remaining backward compatible for users who do not set this value.

Testing
ServiceMonitor Testing:
Verified that when serviceMonitor.enabled is true, a ServiceMonitor resource is created with the proper endpoint configuration (using the port name from the Service).

LoadBalancerIP Testing:
Confirmed that when the service type is LoadBalancer and a loadBalancerIP is provided, the Service correctly includes the loadBalancerIP field.

Conclusion
These changes enhance the usability of the Telegraf Helm chart by providing native support for Prometheus Operator and offering greater control over LoadBalancer configurations. Feedback and further suggestions are welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant