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

Consul server statefulset volume name isn't truncated #798

Closed
tjhiggins opened this issue Oct 20, 2021 · 2 comments · Fixed by #799
Closed

Consul server statefulset volume name isn't truncated #798

tjhiggins opened this issue Oct 20, 2021 · 2 comments · Fixed by #799
Labels
type/bug Something isn't working

Comments

@tjhiggins
Copy link
Contributor

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request. Searching for pre-existing feature requests helps us consolidate datapoints for identical requirements into a single place, thank you!
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.

Overview of the Issue

We dynamically generate namespaces which can sometimes be around 63 chars which is the max for a k8s namespace.
However, the consul helm chart appends a data- when creating the volume mount for the stateful set leading to cases where the volume name can be greater than 63 chars.

Reproduction Steps

Deploy consul helm chart via terraform

resource "helm_release" "consul" {
  name       = "consul"
  repository = "https://helm.releases.hashicorp.com"
  chart      = "consul"
  version    = "0.34.1"
  namespace  = "long-namespace-name-fails-to-create-consul-server-statefulset"
  
  ...
}

Logs

Warning  FailedCreate  2m21s (x20 over 40m)  statefulset-controller  create Pod consul-server-0 in StatefulSet consul-server failed error: Pod "consul-server-0" is invalid: [spec.volumes[0].name: Invalid value: "data-long-namespace-name-fails-to-create-consul-server-statefulset": must be no more than 63 characters,

Expected behavior

Truncate the volume name to 63 chars. Instead of using data-{{ .Release.Namespace }}.
https://github.com/hashicorp/consul-k8s/blob/main/charts/consul/templates/server-statefulset.yaml#L260
Or remove the data- prefix to avoid needing to truncate.

@tjhiggins tjhiggins added the type/bug Something isn't working label Oct 20, 2021
@lkysow
Copy link
Member

lkysow commented Oct 20, 2021

I think we could safely truncate. Removing data- at this stage would delete everyone's PVCs on upgrade so that won't work. But if we truncate then presumably no one could have PVCs with the longer name so that should be safe.

@tjhiggins
Copy link
Contributor Author

I think we could safely truncate. Removing data- at this stage would delete everyone's PVCs on upgrade so that won't work. But if we truncate then presumably no one could have PVCs with the longer name so that should be safe.

Works for me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants