Skip to content

Commit 3a18083

Browse files
committed
Fix deleting pod identities
1 parent b17d037 commit 3a18083

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

pkg/actions/podidentityassociation/deleter.go

+7-6
Original file line numberDiff line numberDiff line change
@@ -116,20 +116,21 @@ func (d *Deleter) DeleteTasks(ctx context.Context, podIDs []Identifier) (*tasks.
116116
return taskTree, nil
117117
}
118118

119-
for _, p := range podIDs {
119+
for _, podID := range podIDs {
120+
podID := podID
120121
piaDeletionTasks := &tasks.TaskTree{
121122
Parallel: false,
122123
IsSubTask: true,
123124
}
124-
piaDeletionTasks.Append(d.makeDeleteTask(ctx, p, roleStackNames))
125+
piaDeletionTasks.Append(d.makeDeleteTask(ctx, podID, roleStackNames))
125126
piaDeletionTasks.Append(&tasks.GenericTask{
126-
Description: fmt.Sprintf("delete service account %q", p.IDString()),
127+
Description: fmt.Sprintf("delete service account %q", podID.IDString()),
127128
Doer: func() error {
128129
if err := kubernetes.MaybeDeleteServiceAccount(d.ClientSet, v1.ObjectMeta{
129-
Name: p.ServiceAccountName,
130-
Namespace: p.Namespace,
130+
Name: podID.ServiceAccountName,
131+
Namespace: podID.Namespace,
131132
}); err != nil {
132-
return fmt.Errorf("failed to delete service account %q: %w", p.IDString(), err)
133+
return fmt.Errorf("failed to delete service account %q: %w", podID.IDString(), err)
133134
}
134135
return nil
135136
},

0 commit comments

Comments
 (0)