Skip to content

[bitnami/elasticsearch] Service name #33775

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

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

Conversation

hket-tommyluk
Copy link
Contributor

Description of the change

This PR updates the Elasticsearch chart to improve the configuration of the service name used by the Kibana subchart.
Specifically, it introduces a new global.elasticsearch.service.fullname value to allow referencing the full Elasticsearch service name, enhancing flexibility when kibanaEnabled is true.
Additionally, the documentation and default values have been updated to reflect this new option and clarify the behavior of global.elasticsearch.service.name.

Benefits

  • Provides more granular control over the Elasticsearch service name referenced by Kibana.
  • Improves chart flexibility for users with customized service naming conventions.
  • Clarifies configuration options in the README and values.yaml for better user understanding.

Possible drawbacks

  • No known drawbacks. This change is backward compatible and does not affect existing deployments unless users opt to use the new service.fullname parameter.

Applicable issues

Additional information

Tested the chart with Kibana enabled and verified that the new service.fullname parameter correctly overrides the service name reference in the Kibana subchart.

Checklist

  • Chart version bumped in Chart.yaml according to semver. This is not necessary when the changes only affect README.md files.
  • Variables are documented in the values.yaml and added to the README.md using readme-generator-for-helm
  • Title of the pull request follows this pattern [bitnami/<name_of_the_chart>] Descriptive title
  • All commits signed off and in agreement of Developer Certificate of Origin (DCO)

@carrodher carrodher added verify Execute verification workflow for these changes in-progress labels May 19, 2025
@github-actions github-actions bot removed the triage Triage is needed label May 19, 2025
@github-actions github-actions bot removed the request for review from carrodher May 19, 2025 20:11
@github-actions github-actions bot requested a review from migruiz4 May 19, 2025 20:11
Copy link
Member

@migruiz4 migruiz4 left a comment

Choose a reason for hiding this comment

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

Hi @hket-tommyluk, thank you for your contribution! Could you please take a look at my comment?

{{- else -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- $name := .Values.global.elasticsearch.service.name -}}
{{- $releaseName := regexReplaceAll "(-?[^a-z\\d\\-])+-?" (lower .Release.Name) "-" -}}
Copy link
Member

Choose a reason for hiding this comment

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

By the regexp, I understand that the goal is to replace non-alphanumeric characters with '-'.

While I understand its utility, we do not usually add this kind of 'fixes' for users invalid inputs.
For example, we have other values such as nameOverride or fullnameOverride which do not include this kind of regexp replacement.

I would rather have helm/kubernetes complain about invalid service name, rather than the chart automatically modifying my inputs to make them valid, for example replacing 'my-n@me' with 'my-n-me'.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for your feedback.

I understand the point that we usually avoid adding fixes for invalid user inputs. However, in this case, .Release.Name is not user input:

  1. .Release.Name does not come from values.yaml.
  2. A valid Helm release name can include lowercase alphanumeric characters, hyphens, and dots. However, dots are not allowed in DNS labels, so the release name may not be a valid DNS label.
  3. The release name is designed to identify the Kubernetes release/project, not necessarily to serve as a DNS label.

According to the RFC 1123 DNS Label standard, resource names must:

  • Contain at most 63 characters
  • Contain only lowercase alphanumeric characters or -
  • Start with an alphanumeric character
  • End with an alphanumeric character

For convenience, Bitnami charts use the release name as the default service name if the user does not override it. However, to comply with DNS label requirements, the release name must be sanitized and converted into a valid DNS label. This is why the existing template includes | trunc 63 | trimSuffix "-", which ensures the name is at most 63 characters and ends with an alphanumeric character (in most cases).

The addition of regexReplaceAll "(-?[^a-z\\d\\-])+-?" (lower .Release.Name) "-" in this PR further ensures the second requirement—that the name contains only lowercase alphanumeric characters or hyphens—is met by replacing invalid characters with -.

In summary, this change is necessary to guarantee that the default service name derived from .Release.Name is always a valid DNS label, avoiding potential issues in Kubernetes resource naming.

Note: This change is to align with #33773.

Copy link

This Pull Request has been automatically marked as "stale" because it has not had recent activity (for 15 days). It will be closed if no further activity occurs. Thank you for your contribution.

@github-actions github-actions bot added the stale 15 days without activity label Jun 21, 2025
@hket-tommyluk
Copy link
Contributor Author

@migruiz4 Please take a look at my reply in your comment. Thanks you.

carrodher and others added 2 commits June 23, 2025 08:10
Signed-off-by: Carlos Rodríguez Hernández <[email protected]>
Signed-off-by: Bitnami Bot <[email protected]>
@github-actions github-actions bot removed the stale 15 days without activity label Jun 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
elasticsearch in-progress verify Execute verification workflow for these changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants