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

fix(helm): truncate metrics service name to comply with DNS naming spec #299

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

Conversation

nwp-mai
Copy link

@nwp-mai nwp-mai commented Mar 4, 2025

This pull request includes changes to the Helm chart to ensure compliance with DNS naming specifications.

  • Added a new template definition for metricsServiceName to truncate the fullname template to 28 characters and append a suffix, ensuring the total length does not exceed 63 characters. (charts/dragonfly-operator/templates/_helpers.tpl)
  • Updated the service name in service.yaml to use the new metricsServiceName template. (charts/dragonfly-operator/templates/service.yaml)

fixes #298

@@ -1,7 +1,7 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "dragonfly-operator.fullname" . }}-controller-manager-metrics-service
name: {{ include "dragonfly-operator.metricsServiceName" . }}
Copy link
Member

Choose a reason for hiding this comment

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

Instead of truncating it to the first 28 characters, I'd refer simplifying the name alltogether.

How about just fullname-controller-service or just fullname-controller-svc?

Copy link
Author

Choose a reason for hiding this comment

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

Sure, we can do that, but the fullname will still get generated from the release name the user chooses, so there's always a chance that it will be too long and needs to be truncated. A shorter suffix won't change that, just make it less likely.

I chose to truncate the fullname to keep the suffix intact, but we could also just truncate at the end.

Unless you want to define a hardcoded name? That would cause issues if a user decides to have two helm releases in the same namespace for some reason

Copy link
Member

Choose a reason for hiding this comment

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

maybe truncate what the user passes to a specific size and then have the controller-svc suffix?

- shorten service name suffix
- rename helper to match new suffix
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.

Helm Chart service names can be too long
2 participants