Skip to content

Conversation

@mboutet
Copy link
Contributor

@mboutet mboutet commented Jul 4, 2025

Description of the change

Make sure to truncate the Statefulsets and Services' name to 63 characters.

Benefits

This guarantees that all the resources are created successfully.

Possible drawback

None, as I made sure to truncate the original fullname while keeping the differentiating suffix as-is (to prevent resource name clash in case the fullname is really long).

Applicable issues

Additional information

I bumped the major version as it could technically cause resources to be recreated due a change in the metadata.name of some Statefulsets and Services. In practice, however, it should not happen as the truncation only happens if really needed, so users already using the chart without issues won't get any truncation. On the other hand, the major bump is also warranted due to the complexity of the chart and the regression risk of this PR even though I tried to not miss anything.

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)

@github-actions github-actions bot added redis triage Triage is needed labels Jul 4, 2025
@github-actions github-actions bot requested a review from carrodher July 4, 2025 14:07
@mboutet mboutet changed the title Ensure that Redis resources are less than 63 chars [bitnami/redis] Ensure that Redis resources are less than 63 chars Jul 4, 2025
@mboutet mboutet marked this pull request as ready for review July 4, 2025 14:12
@mboutet mboutet marked this pull request as draft July 4, 2025 14:46
@mboutet
Copy link
Contributor Author

mboutet commented Jul 4, 2025

Testing on my end, but encountering few issues with my changes, so I'm setting the PR as draft for now.

EDIT: I think it's good now.

@mboutet mboutet marked this pull request as ready for review July 4, 2025 18:20
@carrodher carrodher added verify Execute verification workflow for these changes in-progress labels Jul 5, 2025
@github-actions github-actions bot removed the triage Triage is needed label Jul 5, 2025
@github-actions github-actions bot removed the request for review from carrodher July 5, 2025 11:14
@github-actions github-actions bot requested a review from jotamartos July 5, 2025 11:14
@mboutet mboutet marked this pull request as draft July 9, 2025 18:15
@mboutet
Copy link
Contributor Author

mboutet commented Jul 9, 2025

~Actually, I think there's still an issue with one label having a too long value, but this label comes from the common bitnami chart, so I would have to fix it there :/ ~

It was the value of the controller-revision-hash label in the end.

@mboutet mboutet force-pushed the truncate-long-redis-name branch from 72849ad to b3ceebb Compare July 14, 2025 17:33
@mboutet mboutet closed this Jul 14, 2025
@mboutet mboutet force-pushed the truncate-long-redis-name branch from b3ceebb to 8623aff Compare July 14, 2025 17:34
@mboutet mboutet reopened this Jul 14, 2025
@github-actions github-actions bot added triage Triage is needed and removed solved labels Jul 14, 2025
@github-actions github-actions bot requested a review from carrodher July 14, 2025 17:41
Comment on lines +8 to +31
{{/*
Return the proper Redis master fullname.
The 0000000000 is to take into account the 10-charaters hash that the StatefulSet
appends to the name of the StatefulSet in the pod's controller-revision-hash label.
A label value can only have 63 characters.
*/}}
{{- define "redis.master.fullname" -}}
{{- printf "%s-%s" ((include "common.names.fullname" .) | trunc ((sub 63 ("-master-0000000000" | len)) | int) | trimSuffix "-") "master" -}}
{{- end -}}
{{/*
Return the proper Redis replicas fullname
*/}}
{{- define "redis.replicas.fullname" -}}
{{- printf "%s-%s" ((include "common.names.fullname" .) | trunc ((sub 63 ("-replicas-0000000000" | len)) | int) | trimSuffix "-") "replicas" -}}
{{- end -}}
{{/*
Return the proper Redis sentinel fullname
*/}}
{{- define "redis.sentinel.fullname" -}}
{{- printf "%s-%s" ((include "common.names.fullname" .) | trunc ((sub 63 ("-node-0000000000" | len)) | int) | trimSuffix "-") "node" -}}
{{- end -}}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since the Service also uses this helper, it could result in it being recreated for some users. Truncating the equivalent of 0000000000 is only strictly needed for the Statefulset in reality.

@jotamartos
Copy link
Contributor

Hi @mboutet,

I just updated the thread with more information. Let me know if it's clear now.

@github-actions
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 Aug 22, 2025
mboutet and others added 2 commits August 22, 2025 11:26
@github-actions github-actions bot removed the stale 15 days without activity label Aug 23, 2025
@github-actions
Copy link

github-actions bot commented Sep 7, 2025

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 Sep 7, 2025
mboutet and others added 2 commits September 8, 2025 09:17
@github-actions github-actions bot removed the stale 15 days without activity label Sep 9, 2025
@github-actions
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 Sep 25, 2025
mboutet and others added 2 commits September 25, 2025 15:07
@github-actions github-actions bot removed the stale 15 days without activity label Sep 26, 2025
@github-actions
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 Oct 11, 2025
@github-actions github-actions bot removed the stale 15 days without activity label Oct 15, 2025
@jotamartos
Copy link
Contributor

Sorry @mboutet, I lost track of this ticket. Let me review it again and provide feedback

Copy link
Contributor

@jotamartos jotamartos left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution but your changes return errors when deploying the solution

➜  redis git:(truncate-long-redis-name) helm install redis 
Error: INSTALLATION FAILED: parse error at (redis/templates/scripts-configmap.yaml:690): unexpected <template> in command

A label value can only have 63 characters.
*/}}
{{- define "redis.master.fullname" -}}
{{- printf "%s-%s" ((include "common.names.fullname" .) | trunc ((sub 63 ("-master-0000000000" | len)) | int) | trimSuffix "-") "master" -}}
Copy link
Contributor

Choose a reason for hiding this comment

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

Current fullnames do not include the "0000000000" string, so it's not necessary to remove that

➜  redis git:(main) k get all                      
NAME                   READY   STATUS    RESTARTS   AGE
pod/redis-master-0     1/1     Running   0          2m29s
pod/redis-replicas-0   1/1     Running   0          2m28s
pod/redis-replicas-1   1/1     Running   0          91s
pod/redis-replicas-2   1/1     Running   0          51s

NAME                     TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)    AGE
service/redis-headless   ClusterIP   None           <none>        6379/TCP   2m29s
service/redis-master     ClusterIP   10.0.92.51     <none>        6379/TCP   2m29s
service/redis-replicas   ClusterIP   10.0.203.103   <none>        6379/TCP   2m29s

NAME                              READY   AGE
statefulset.apps/redis-master     1/1     2m30s
statefulset.apps/redis-replicas   3/3     2m30s

@github-actions
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 Nov 15, 2025
@github-actions
Copy link

Due to the lack of activity in the last 5 days since it was marked as "stale", we proceed to close this Pull Request. Do not hesitate to reopen it later if necessary.

@bitnami-bot bitnami-bot added stale 15 days without activity and removed stale 15 days without activity labels Nov 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

redis solved stale 15 days without activity verify Execute verification workflow for these changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bitnami/redis] Long release name breaks statefulset pods

4 participants