From f4a84a6786549478f5bb73eeb4acd16bf27eda1e Mon Sep 17 00:00:00 2001 From: Mathis Marcotte Date: Fri, 7 Feb 2025 19:45:45 +0000 Subject: [PATCH] fix vol mount injection to use correct container index --- 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, }) }