Skip to content

Commit e76d634

Browse files
committed
Fix empty AnsibleTest workload key
Currently, if user doesn't specify the WorkloadSSHKeySecretName in AnsibleTest CR type, the pod creation is stuck. The reason is that the test-operator is always trying to mount the workload-ssh-secret Secret, but the default is an empty string.
1 parent dc0efcc commit e76d634

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

pkg/ansibletest/volumes.go

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -93,17 +93,19 @@ func GetVolumes(
9393

9494
volumes = append(volumes, keysVolume)
9595

96-
keysVolume = corev1.Volume{
97-
Name: "workload-ssh-secret",
98-
VolumeSource: corev1.VolumeSource{
99-
Secret: &corev1.SecretVolumeSource{
100-
SecretName: workflowOverrideParams["WorkloadSSHKeySecretName"],
101-
DefaultMode: &privateKeyMode,
96+
if workflowOverrideParams["WorkloadSSHKeySecretName"] != "" {
97+
keysVolume = corev1.Volume{
98+
Name: "workload-ssh-secret",
99+
VolumeSource: corev1.VolumeSource{
100+
Secret: &corev1.SecretVolumeSource{
101+
SecretName: workflowOverrideParams["WorkloadSSHKeySecretName"],
102+
DefaultMode: &privateKeyMode,
103+
},
102104
},
103-
},
104-
}
105+
}
105106

106-
volumes = append(volumes, keysVolume)
107+
volumes = append(volumes, keysVolume)
108+
}
107109

108110
for _, exv := range instance.Spec.ExtraMounts {
109111
for _, vol := range exv.Propagate(svc) {

0 commit comments

Comments
 (0)