Skip to content

Commit 24cf1d2

Browse files
committed
Remove HorizonTest volume mount for keys
While doing a test-operator refactor, I have noticed that private and public keys in HorizonTest resource are never created. The variable that decides if they are is always false. If there is no use for the keys, we should just remove the section.
1 parent e4cbde8 commit 24cf1d2

File tree

3 files changed

+1
-27
lines changed

3 files changed

+1
-27
lines changed

controllers/horizontest_controller.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,6 @@ func (r *HorizonTestReconciler) Reconcile(ctx context.Context, req ctrl.Request)
206206

207207
// Create Job
208208
mountCerts := r.CheckSecretExists(ctx, instance, "combined-ca-bundle")
209-
210-
mountKeys := false
211-
212209
mountKubeconfig := len(instance.Spec.KubeconfigSecretName) != 0
213210

214211
// Prepare HorizonTest env vars
@@ -226,7 +223,6 @@ func (r *HorizonTestReconciler) Reconcile(ctx context.Context, req ctrl.Request)
226223
podName,
227224
logsPVCName,
228225
mountCerts,
229-
mountKeys,
230226
mountKubeconfig,
231227
envVars,
232228
containerImage,

pkg/horizontest/pod.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ func Pod(
1616
podName string,
1717
logsPVCName string,
1818
mountCerts bool,
19-
mountKeys bool,
2019
mountKubeconfig bool,
2120
envVars map[string]env.Setter,
2221
containerImage string,
@@ -50,7 +49,7 @@ func Pod(
5049
Image: containerImage,
5150
Args: []string{},
5251
Env: env.MergeEnvs([]corev1.EnvVar{}, envVars),
53-
VolumeMounts: GetVolumeMounts(mountCerts, mountKeys, mountKubeconfig, HorizonTestPropagation, instance),
52+
VolumeMounts: GetVolumeMounts(mountCerts, mountKubeconfig, HorizonTestPropagation, instance),
5453
SecurityContext: &securityContext,
5554
Resources: instance.Spec.Resources,
5655
},

pkg/horizontest/volumes.go

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,6 @@ func GetVolumes(
144144
// GetVolumeMounts -
145145
func GetVolumeMounts(
146146
mountCerts bool,
147-
mountKeys bool,
148147
mountKubeconfig bool,
149148
svc []storage.PropagationType,
150149
instance *testv1beta1.HorizonTest,
@@ -205,26 +204,6 @@ func GetVolumeMounts(
205204
volumeMounts = append(volumeMounts, caCertVolumeMount)
206205
}
207206

208-
if mountKeys {
209-
keysMount := corev1.VolumeMount{
210-
Name: "horizontest-private-key",
211-
MountPath: "/etc/test_operator/id_ecdsa",
212-
SubPath: "id_ecdsa",
213-
ReadOnly: true,
214-
}
215-
216-
volumeMounts = append(volumeMounts, keysMount)
217-
218-
keysMount = corev1.VolumeMount{
219-
Name: "horizontest-public-key",
220-
MountPath: "/etc/test_operator/id_ecdsa.pub",
221-
SubPath: "id_ecdsa.pub",
222-
ReadOnly: true,
223-
}
224-
225-
volumeMounts = append(volumeMounts, keysMount)
226-
}
227-
228207
if mountKubeconfig {
229208
kubeconfigMount := corev1.VolumeMount{
230209
Name: "kubeconfig",

0 commit comments

Comments
 (0)