Skip to content

Commit

Permalink
#349 Fix Helm upgrade issue with PVC
Browse files Browse the repository at this point in the history
  • Loading branch information
tomaszsek committed Jun 7, 2020
1 parent fcfeb30 commit 87ee491
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
8 changes: 7 additions & 1 deletion chart/jenkins-operator/templates/backup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,13 @@ metadata:
app: jenkins-operator
jenkins-cr: {{ .Values.jenkins.name }}
spec:
storageClassName: {{ .Values.jenkins.backup.pvc.className }}
{{- if .Values.jenkins.backup.pvc.className }}
{{- if (eq "-" .Values.jenkins.backup.pvc.className) }}
storageClassName: ""
{{- else }}
storageClassName: "{{ .Values.jenkins.backup.pvc.className }}"
{{- end }}
{{- end }}
accessModes:
- ReadWriteOnce
resources:
Expand Down
2 changes: 1 addition & 1 deletion chart/jenkins-operator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ jenkins:

# className is storageClassName for PVC
# See https://kubernetes.io/docs/concepts/storage/persistent-volumes/#class-1 for more details
className: ""
className: "-"

# env contains container environment variables
# PVC backup provider handles these variables:
Expand Down
12 changes: 10 additions & 2 deletions test/e2e/helm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,19 @@ func TestDeployHelmChart(t *testing.T) {
},
}

cmd := exec.Command("helm", "install", "helm", "./chart/jenkins-operator", "--namespace", namespace, "--debug",
"--set-string", fmt.Sprintf("jenkins.namespace=%s", namespace))
cmd := exec.Command("helm", "upgrade", "jenkins", "./chart/jenkins-operator", "--namespace", namespace, "--debug",
"--set-string", fmt.Sprintf("jenkins.namespace=%s", namespace, "--install"))
output, err := cmd.CombinedOutput()
require.NoError(t, err, string(output))

waitForJenkinsBaseConfigurationToComplete(t, jenkins)
waitForJenkinsUserConfigurationToComplete(t, jenkins)

cmd = exec.Command("helm", "upgrade", "jenkins", "./chart/jenkins-operator", "--namespace", namespace, "--debug",
"--set-string", fmt.Sprintf("jenkins.namespace=%s", namespace, "--install"))
output, err = cmd.CombinedOutput()
require.NoError(t, err, string(output))

// Then
waitForJenkinsBaseConfigurationToComplete(t, jenkins)
waitForJenkinsUserConfigurationToComplete(t, jenkins)
Expand Down

0 comments on commit 87ee491

Please sign in to comment.