Skip to content
This repository has been archived by the owner on Jun 24, 2022. It is now read-only.

[Sonatype-Nexus] strange PVC name #336

Open
mtcolman opened this issue Feb 23, 2022 · 0 comments
Open

[Sonatype-Nexus] strange PVC name #336

mtcolman opened this issue Feb 23, 2022 · 0 comments

Comments

@mtcolman
Copy link
Contributor

mtcolman commented Feb 23, 2022

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?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant