From 142f6cd1f0715cbb9954cd5ee7428d4b9bb9c1a6 Mon Sep 17 00:00:00 2001 From: Sebastian Widmer Date: Fri, 26 Jan 2024 15:24:54 +0100 Subject: [PATCH] Fully initialize type information Patch can't do a grpc roundtrip (yet) so objects need the full type information. --- pkg/billingrbac/billingrbac.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/pkg/billingrbac/billingrbac.go b/pkg/billingrbac/billingrbac.go index 0d14e64b..7b8fb35d 100644 --- a/pkg/billingrbac/billingrbac.go +++ b/pkg/billingrbac/billingrbac.go @@ -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, }, @@ -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, }, @@ -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, }, @@ -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, },