Skip to content

Commit

Permalink
Fully initialize type information
Browse files Browse the repository at this point in the history
Patch can't do a grpc roundtrip (yet) so objects need the full type information.
  • Loading branch information
bastjan committed Jan 26, 2024
1 parent a772f61 commit 142f6cd
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions pkg/billingrbac/billingrbac.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ type ClusterRolesParams struct {
func ClusterRoles(beName string, p ClusterRolesParams) (ar *rbacv1.ClusterRole, arBinding *rbacv1.ClusterRoleBinding, vr *rbacv1.ClusterRole, vrBinding *rbacv1.ClusterRoleBinding) {
viewRoleName := fmt.Sprintf("billingentities-%s-viewer", beName)
viewRole := &rbacv1.ClusterRole{
TypeMeta: metav1.TypeMeta{
APIVersion: "rbac.authorization.k8s.io/v1",
Kind: "ClusterRole",
},
ObjectMeta: metav1.ObjectMeta{
Name: viewRoleName,
},
Expand All @@ -42,6 +46,10 @@ func ClusterRoles(beName string, p ClusterRolesParams) (ar *rbacv1.ClusterRole,
})
}
viewRoleBinding := &rbacv1.ClusterRoleBinding{
TypeMeta: metav1.TypeMeta{
APIVersion: "rbac.authorization.k8s.io/v1",
Kind: "ClusterRoleBinding",
},
ObjectMeta: metav1.ObjectMeta{
Name: viewRoleName,
},
Expand All @@ -54,6 +62,10 @@ func ClusterRoles(beName string, p ClusterRolesParams) (ar *rbacv1.ClusterRole,
}
adminRoleName := fmt.Sprintf("billingentities-%s-admin", beName)
adminRole := &rbacv1.ClusterRole{
TypeMeta: metav1.TypeMeta{
APIVersion: "rbac.authorization.k8s.io/v1",
Kind: "ClusterRole",
},
ObjectMeta: metav1.ObjectMeta{
Name: adminRoleName,
},
Expand Down Expand Up @@ -81,6 +93,10 @@ func ClusterRoles(beName string, p ClusterRolesParams) (ar *rbacv1.ClusterRole,
})
}
adminRoleBinding := &rbacv1.ClusterRoleBinding{
TypeMeta: metav1.TypeMeta{
APIVersion: "rbac.authorization.k8s.io/v1",
Kind: "ClusterRoleBinding",
},
ObjectMeta: metav1.ObjectMeta{
Name: adminRoleName,
},
Expand Down

0 comments on commit 142f6cd

Please sign in to comment.