Skip to content

Commit

Permalink
Fixes (#533)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelawyu committed Sep 19, 2023
1 parent cf400b2 commit 05f2d15
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ func (r *Reconciler) syncRole(ctx context.Context, mc *clusterv1beta1.MemberClus
Namespace: namespaceName,
OwnerReferences: []metav1.OwnerReference{*toOwnerReference(mc)},
},
Rules: []rbacv1.PolicyRule{utils.FleetRule, utils.EventRule, utils.FleetNetworkRule, utils.WorkRule},
Rules: []rbacv1.PolicyRule{utils.FleetClusterRule, utils.FleetPlacementRule, utils.FleetNetworkRule, utils.EventRule},
}

// Creates role if not found.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ func TestSyncRole(t *testing.T) {
Name: "fleet-role-mc1",
Namespace: namespace1,
},
Rules: []rbacv1.PolicyRule{utils.FleetRule, utils.EventRule, utils.FleetNetworkRule, utils.WorkRule},
Rules: []rbacv1.PolicyRule{utils.FleetClusterRule, utils.FleetPlacementRule, utils.FleetNetworkRule, utils.EventRule},
}
return nil
},
Expand Down
12 changes: 12 additions & 0 deletions pkg/utils/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ import (
"k8s.io/klog/v2"
workv1alpha1 "sigs.k8s.io/work-api/pkg/apis/v1alpha1"

clusterv1beta1 "go.goms.io/fleet/apis/cluster/v1beta1"
placementv1beta1 "go.goms.io/fleet/apis/placement/v1beta1"
fleetv1alpha1 "go.goms.io/fleet/apis/v1alpha1"
"go.goms.io/fleet/pkg/utils/controller"
"go.goms.io/fleet/pkg/utils/informer"
Expand Down Expand Up @@ -68,6 +70,16 @@ var (
APIGroups: []string{fleetv1alpha1.GroupVersion.Group},
Resources: []string{"*"},
}
FleetClusterRule = rbacv1.PolicyRule{
Verbs: []string{"*"},
APIGroups: []string{clusterv1beta1.GroupVersion.Group},
Resources: []string{"*"},
}
FleetPlacementRule = rbacv1.PolicyRule{
Verbs: []string{"*"},
APIGroups: []string{placementv1beta1.GroupVersion.Group},
Resources: []string{"*"},
}
EventRule = rbacv1.PolicyRule{
Verbs: []string{"get", "list", "update", "patch", "watch", "create"},
APIGroups: []string{""},
Expand Down

0 comments on commit 05f2d15

Please sign in to comment.