Skip to content

Commit 485c390

Browse files
committed
Fix AnsibleTest workload key
In a previous patch, there was an effort to fix the empty AnsibleTest workload key issue. However one more if condition is needed to make it work, which will be added in this fix.
1 parent 574547d commit 485c390

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

pkg/ansibletest/volumes.go

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -219,14 +219,16 @@ func GetVolumeMounts(
219219
volumeMounts = append(volumeMounts, caCertVolumeMount)
220220
}
221221

222-
workloadSSHKeyMount := corev1.VolumeMount{
223-
Name: "workload-ssh-secret",
224-
MountPath: "/var/lib/ansible/test_keypair.key",
225-
SubPath: "ssh-privatekey",
226-
ReadOnly: true,
227-
}
222+
if instance.Spec.WorkloadSSHKeySecretName != "" {
223+
workloadSSHKeyMount := corev1.VolumeMount{
224+
Name: "workload-ssh-secret",
225+
MountPath: "/var/lib/ansible/test_keypair.key",
226+
SubPath: "ssh-privatekey",
227+
ReadOnly: true,
228+
}
228229

229-
volumeMounts = append(volumeMounts, workloadSSHKeyMount)
230+
volumeMounts = append(volumeMounts, workloadSSHKeyMount)
231+
}
230232

231233
computeSSHKeyMount := corev1.VolumeMount{
232234
Name: "compute-ssh-secret",

0 commit comments

Comments
 (0)