chartmuseum / charts

ChartMuseum Project Helm Charts
https://artifacthub.io/packages/search?repo=chartmuseum
54 stars 57 forks source link

Add volumeName if found to pvc #27

Closed rfashwall closed 2 years ago

rfashwall commented 3 years ago

Issue (why)

volumeName for pvc is added and tight to pv, hence it is only added if pv is enabled. This is causing issues if pv is already created and want to create a pvc with this existing volume

Solution

volumeName for pvc should be independent from pv and added if found.

Test

using helm template . the below is generated successfully:

---
# Source: chartmuseum/templates/secret.yaml
apiVersion: v1
kind: Secret
metadata:
  name: RELEASE-NAME-chartmuseum
  labels:
    helm.sh/chart: chartmuseum-3.3.0
    app.kubernetes.io/name: chartmuseum
    app.kubernetes.io/instance: RELEASE-NAME
    app.kubernetes.io/version: "0.13.1"
    app.kubernetes.io/managed-by: Helm
type: Opaque
data:
---
# Source: chartmuseum/templates/pvc.yaml
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: RELEASE-NAME-chartmuseum
  labels:
    app.kubernetes.io/name: chartmuseum
    app.kubernetes.io/instance: RELEASE-NAME
spec:
  accessModes:
    - "ReadWriteOnce"
  resources:
    requests:
      storage: "8Gi"
  storageClassName: "ssg"
  volumeName: "test"              # <============= added volumeName when found without generating pv
---
# Source: chartmuseum/templates/service.yaml
apiVersion: v1
kind: Service
metadata:
  name: RELEASE-NAME-chartmuseum
  labels:
    helm.sh/chart: chartmuseum-3.3.0
    app.kubernetes.io/name: chartmuseum
    app.kubernetes.io/instance: RELEASE-NAME
    app.kubernetes.io/version: "0.13.1"
    app.kubernetes.io/managed-by: Helm
spec:
  type: ClusterIP
  ports:
  - port: 8080
    targetPort: http
    protocol: TCP
    name: http
  selector:
    app.kubernetes.io/name: chartmuseum
    app.kubernetes.io/instance: RELEASE-NAME
---
# Source: chartmuseum/templates/deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: RELEASE-NAME-chartmuseum
  labels:
    helm.sh/chart: chartmuseum-3.3.0
    app.kubernetes.io/name: chartmuseum
    app.kubernetes.io/instance: RELEASE-NAME
    app.kubernetes.io/version: "0.13.1"
    app.kubernetes.io/managed-by: Helm
spec:
  selector:
    matchLabels:
      app.kubernetes.io/name: chartmuseum
      app.kubernetes.io/instance: RELEASE-NAME
  replicas: 1
  strategy:
    rollingUpdate:
      maxUnavailable: 0
    type: RollingUpdate
  revisionHistoryLimit: 10
  template:
    metadata:
      labels:
        app.kubernetes.io/name: chartmuseum
        app.kubernetes.io/instance: RELEASE-NAME
    spec:
      securityContext:
        fsGroup: 1000      
      containers:
      - name: chartmuseum
        image: ghcr.io/helm/chartmuseum:v0.13.1
        imagePullPolicy: IfNotPresent
        securityContext:
          {}
        env:
        - name: "CHART_POST_FORM_FIELD_NAME"
          value: "chart"
        - name: "DISABLE_API"
          value: "true"
        - name: "DISABLE_METRICS"
          value: "true"
        - name: "LOG_JSON"
          value: "true"
        - name: "PROV_POST_FORM_FIELD_NAME"
          value: "prov"
        - name: "STORAGE"
          value: "local"
        args:
        - --port=8080
        - --storage-local-rootdir=/storage
        ports:
        - name: http
          containerPort: 8080
        livenessProbe:
          httpGet:
            path: /health
            port: http
          failureThreshold: 3
          initialDelaySeconds: 5
          periodSeconds: 10
          successThreshold: 1
          timeoutSeconds: 1
        readinessProbe:
          httpGet:
            path: /health
            port: http
          failureThreshold: 3
          initialDelaySeconds: 5
          periodSeconds: 10
          successThreshold: 1
          timeoutSeconds: 1
        volumeMounts:
        - mountPath: /storage
          name: storage-volume
      serviceAccountName: default
      automountServiceAccountToken: false
      volumes:
      - name: storage-volume
        persistentVolumeClaim:
          claimName: RELEASE-NAME-chartmuseum
rfashwall commented 2 years ago

cc @jdolitsky

jdolitsky commented 2 years ago

@rfashwall - actually, 3.4.1 may be more appropriate if you consider this a bug

rfashwall commented 2 years ago

@jdolitsky thanks for the feedback. It is updated now.

rfashwall commented 2 years ago

@jdolitsky please check 🙂

cbuto commented 2 years ago

@rfashwall A few changes have happened since the last comments here, if you rebase and bump the chart version to 3.6.1, we can get this merged through!

rfashwall commented 2 years ago

@rfashwall A few changes have happened since the last comments here, if you rebase and bump the chart version to 3.6.1, we can get this merged through!

thanks @cbuto for the update, done