From b09c63138df0c56f527d53867ae99839c24be7ef Mon Sep 17 00:00:00 2001 From: Mathis <84033116+mathis-marcotte@users.noreply.github.com> Date: Mon, 10 Feb 2025 08:32:52 -0500 Subject: [PATCH] fix vol mount injection to use correct container index (#4) --- cmd/webhook.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/webhook.go b/cmd/webhook.go index 139de91..dca5a79 100644 --- a/cmd/webhook.go +++ b/cmd/webhook.go @@ -189,20 +189,20 @@ func updateWorkingVolumeMounts(targetContainerSpec []corev1.Container, isFirst b patch = append(patch, patchOperation{ Op: "add", // the path for only the first value - Path: "/spec/containers/0/volumeMounts", + Path: fmt.Sprintf("/spec/containers/%d/volumeMounts", key), Value: mapSlice, }) } else { patch = append(patch, patchOperation{ Op: "add", // Now that there is one that has created an array, this can just go after it. - Path: "/spec/containers/0/volumeMounts/-", + Path: fmt.Sprintf("/spec/containers/%d/volumeMounts/-", key), Value: credsCache, }) patch = append(patch, patchOperation{ Op: "add", // Now that there is one that has created an array, this can just go after it. - Path: "/spec/containers/0/volumeMounts/-", + Path: fmt.Sprintf("/spec/containers/%d/volumeMounts/-", key), Value: kerbConf, }) }