-
Notifications
You must be signed in to change notification settings - Fork 226
[Sonatype-Nexus] strange PVC name #336
Description
Hi, I'm creating a release mc-testn
and using statefulset.enabed=true
and persistence.enabled=true
. The PVC that gets created for me is called:
mc-testn-sonatype-nexus-data-mc-testn-sonatype-nexus-0
And I can't work out why it is given this name, as the pvc.yaml code is:
name: {{ template "nexus.fullname" . }}-data
(But pvc.yaml isn't being used because I don't match {{- if not .Values.statefulset.enabled }}
).
So it appears it is appending "-mc-testn-sonatype-nexus-0
" somehow?
Thanks.
edit:
I've done some further testing, editing the deployment-statefulset.yaml.
If I set the pvc volumeClaimTemplate
as follows:
## create pvc in case of statefulsets
volumeClaimTemplates:
- metadata:
name: mc-testa-sonatype-nexus-data # notice: mc-testa
labels:
app: sonatype-nexus
fullname: mc-testb-sonatype-nexus # notice: mc-testb
chart: sonatype-nexus
release: mc-testc # notice: mc-testc
heritage: Helm
spec:
accessModes:
- "ReadWriteOnce"
resources:
requests:
storage: "8Gi"
And statefulset spec as:
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: mc-testc-sonatype-nexus # notice: mc-testc
...
...
volumeMounts:
- mountPath: /nexus-data
name: mc-testc-sonatype-nexus-data # notice: mc-testc
I get:
oc get pvc
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
mc-testa-sonatype-nexus-data-mc-testc-sonatype-nexus-0 Bound pvc-12a6a39a-1eb3-49d4-8a52-f8d7f19bd01d 20Gi RWO ibmc-block-gold 3m55s
A further test, using:
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: mc-teste-sonatype-nexus # notice: mc-teste
volumeClaimTemplates:
- metadata:
name: mc-testa-sonatype-nexus-data # notice: mc-testa
labels:
app: sonatype-nexus
fullname: mc-testb-sonatype-nexus
chart: sonatype-nexus
release: mc-testf
heritage: Helm
Shows it's these two values that are coming into play.
Given that the statefulSet/deployment needs the full name rendering, does the PVC really need it repeated twice?
Could the PVC config in deployment-statefulset.yaml be changed to:
## create pvc in case of statefulsets
{{- if .Values.statefulset.enabled }}
volumeClaimTemplates:
{{- if .Values.persistence.enabled }}
- metadata:
name: "data"
Which (when done locally in my copy of the chart), creates a PVC named:
data-mc-testx-sonatype-nexus-0
Or something like that?