Skip to content

Commit f484b9e

Browse files
authored
fix: role patching (#325)
Closes: #318 Signed-off-by: Leonardo Cecchi <[email protected]>
1 parent 9db184f commit f484b9e

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

internal/cnpgi/operator/reconciler.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,13 @@ func (r ReconcilerImplementation) ensureRole(
160160
"rules", newRole.Rules,
161161
)
162162

163-
return r.Client.Patch(ctx, newRole, client.MergeFrom(&role))
163+
oldRole := role.DeepCopy()
164+
165+
// Apply to the role the new rules
166+
role.Rules = newRole.Rules
167+
168+
// Push it back to the API server
169+
return r.Client.Patch(ctx, &role, client.MergeFrom(oldRole))
164170
}
165171

166172
func (r ReconcilerImplementation) ensureRoleBinding(

0 commit comments

Comments
 (0)