jenkins-x / jx

Jenkins X provides automated CI+CD for Kubernetes with Preview Environments on Pull Requests using Cloud Native pipelines from Tekton
https://jenkins-x.io/
Apache License 2.0
4.58k stars 787 forks source link

Persistent Volume Claim template is ignored by JenkinsX #8070

Open bartoliniii opened 2 years ago

bartoliniii commented 2 years ago

Persistent Volume Claim defined in my helm template directory is ignored and Jenkins X is not deploying it. PVC defined for external projects like Jenkins works correctly, problem is with our own projects.

jx-boot version: 3.2.250

Here is definition of my pvc (file pvc.yaml):

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: {{ template "fullname" . }}
  labels:
  {{- if .Values.pcvLabels }}
  {{ toYaml .Values.pcvLabels | indent 6 }}
  {{- end }}
  {{- if .Values.pcvLabels }}
  annotations:
  {{ toYaml .Values.pvcAnnotations | indent 8 }}
  {{- end }}
spec:
  storageClassName: {{ .Values.persistence.storageClassName }}
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: {{ .Values.persistence.size | quote }}

In boot logs I see that Jenkins X is discovering this file:

Templating release=my-repo-release, chart=dev/my-repo
wrote /tmp/generate/jx-production/my-repo-release/my-repo/templates/secrets.yaml
wrote /tmp/generate/jx-production/my-repo-release/my-repo/templates/pvc.yaml
wrote /tmp/generate/jx-production/my-repo-release/my-repo/templates/service.yaml
wrote /tmp/generate/jx-production/my-repo-release/my-repo/templates/deployment.yaml
wrote /tmp/generate/jx-production/my-repo-release/my-repo/templates/ingress.yaml

and commits correct content (when I apply it by kubectl manually it works correctly):

# Source: my-repo/templates/pvc.yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: my-repo-release
  labels:
  annotations:
    meta.helm.sh/release-name: 'my-repo-release'
  namespace: jx-production
spec:
  storageClassName: microk8s-hostpath
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: "200Mi"

But unfortunately, pvc is not deployed and there is no log about deploying it:

externalsecret.kubernetes-client.io/my-repo-release-basic-auth unchanged
deployment.apps/my-repo-release created
ingress.networking.k8s.io/my-repo-release created
service/my-repo-release created
msvticket commented 2 years ago

Maybe it has something to do with that the labels field has no value in PersistentVolumeClaim.