mittwald/kubernetes-replicator

Unable to replicate a RoleBinding containing a ClusterRole role reference.

vsimon opened this issue · 2 comments

Describe the bug
Unable to replicate a RoleBinding containing a ClusterRole role reference.

To Reproduce
Steps to reproduce the behavior. Please provide appropriate Kubernetes manifests for reproducing the behavior.

  • Create any ClusterRole named "existing-cluster-role". ClusterRoles exist outside of any namespaces.
  • Create namespaces "test-source", "test-destination"
  • Apply this RoleBinding in the "test-source" namespace
kind: RoleBinding  
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: test-role-binding
  namespace: test-source
  annotations:
    replicator.v1.mittwald.de/replicate-to: test-destination
subjects:
- kind: User
  name: some_user
roleRef:
  kind: ClusterRole
  name: existing-cluster-role
  apiGroup: rbac.authorization.k8s.io
---

Expected behavior

RoleBinding is replicated to the "test-destination" namespace

Environment:

  • Kubernetes version: 1.19
  • kubernetes-replicator version: 2.6.2

Additional context
Add any other context about the problem here.

FIrst cut was to try to call canReplicate only when the kind is "Role" since it internally calls a "get" on r.Client.RbacV1().Roles() with the given name passed in.

Thank you for the contribution!
Released as v2.6.3 :)