Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions internal/elevation/queries.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,14 @@ func Create(ctx context.Context, input *CreateElevationInput, actor *authz.Actor
role := buildRoleUnstructured(elevationID, namespace, input, actor, createdAt, expiresAt)
_, err := k8sClient.Resource(roleGVR).Namespace(namespace).Create(ctx, role, metav1.CreateOptions{})
if err != nil {
clients.log.WithError(err).WithField("namespace", namespace).Error("failed to create elevation role")
return nil, fmt.Errorf("creating role: %w", err)
}

roleBinding := buildRoleBindingUnstructured(elevationID, namespace, actor, createdAt, expiresAt)
_, err = k8sClient.Resource(roleBindingGVR).Namespace(namespace).Create(ctx, roleBinding, metav1.CreateOptions{})
if err != nil {
clients.log.WithError(err).WithField("namespace", namespace).Error("failed to create elevation rolebinding")
_ = k8sClient.Resource(roleGVR).Namespace(namespace).Delete(ctx, elevationID, metav1.DeleteOptions{})
return nil, fmt.Errorf("creating rolebinding: %w", err)
}
Expand Down