Skip to content

Commit 63f8b5c

Browse files
committed
refactor(webhook.go): bool logic
1 parent 1badb53 commit 63f8b5c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

cmd/webhook.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,8 @@ func mutationRequired(metadata *metav1.ObjectMeta) bool {
115115

116116
// addContainerTracked adds containers using a boolean to determine if it's the first addition
117117
// This fixes the bug where multiple loop iterations would overwrite previous additions
118-
func addContainerTracked(alreadyAdded bool, added []corev1.Container, basePath string) (patch []patchOperation) {
119-
first := !alreadyAdded
118+
func addContainerTracked(isFirst bool, added []corev1.Container, basePath string) (patch []patchOperation) {
119+
first := isFirst
120120
var value interface{}
121121
for _, add := range added {
122122
value = add
@@ -138,8 +138,8 @@ func addContainerTracked(alreadyAdded bool, added []corev1.Container, basePath s
138138

139139
// addVolumeTracked adds volumes using a boolean to determine if it's the first addition
140140
// This fixes the bug where multiple loop iterations would overwrite previous additions
141-
func addVolumeTracked(alreadyAdded bool, added []corev1.Volume, basePath string) (patch []patchOperation) {
142-
first := !alreadyAdded
141+
func addVolumeTracked(isFirst bool, added []corev1.Volume, basePath string) (patch []patchOperation) {
142+
first := isFirst
143143
var value interface{}
144144
for _, add := range added {
145145
value = add

0 commit comments

Comments
 (0)