Skip to content

Commit

Permalink
Fix missing kubebuilder generation
Browse files Browse the repository at this point in the history
Signed-off-by: Andrea Mazzotti <[email protected]>
  • Loading branch information
anmazzotti committed Jan 10, 2025
1 parent 3e2336e commit 34e46a0
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 51 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ generate-manifests-external: vendor controller-gen ## Generate ClusterRole and C

.PHONY: generate-manifests-api
generate-manifests-api: controller-gen ## Generate ClusterRole and CustomResourceDefinition objects.
$(CONTROLLER_GEN) rbac:roleName=manager-role crd paths="./api/v1alpha1/..." \
$(CONTROLLER_GEN) rbac:roleName=manager-role crd paths="./api/v1alpha1/..." paths="./internal/controllers/..." \
output:crd:artifacts:config=./config/crd/bases \
output:rbac:dir=./config/rbac \

Expand Down
52 changes: 31 additions & 21 deletions charts/rancher-turtles/templates/rancher-turtles-components.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3366,19 +3366,8 @@ rules:
resources:
- configmaps
- events
- secrets
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- ""
resources:
- namespaces
- secrets
verbs:
- create
- delete
Expand All @@ -3393,7 +3382,6 @@ rules:
- clusters
- clusters/status
verbs:
- create
- get
- list
- patch
Expand All @@ -3409,6 +3397,7 @@ rules:
- update
- apiGroups:
- infrastructure.cluster.x-k8s.io
- operator.cluster.x-k8s.io
resources:
- '*'
verbs:
Expand All @@ -3424,11 +3413,11 @@ rules:
resources:
- clusterregistrationtokens
- clusterregistrationtokens/status
- settings
verbs:
- get
- list
- watch
- create
- apiGroups:
- management.cattle.io
resources:
Expand Down Expand Up @@ -3460,27 +3449,48 @@ rules:
- turtles-capi.cattle.io
resources:
- capiproviders
- capiproviders/status
- clusterctlconfigs
- clusterctlconfigs/status
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- turtles-capi.cattle.io
resources:
- capiproviders/finalizers
verbs:
- update
- apiGroups:
- turtles-capi.cattle.io
resources:
- capiproviders/status
verbs:
- get
- patch
- update
- apiGroups:
- operator.cluster.x-k8s.io
- turtles-capi.cattle.io
resources:
- '*'
- clusterctlconfigs
- clusterctlconfigs/status
verbs:
- create
- get
- list
- patch
- watch
- apiGroups:
- turtles-capi.cattle.io
resources:
- clusterctlconfigs/finalizers
verbs:
- get
- list
- patch
- update
- create
- watch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
Expand Down
64 changes: 37 additions & 27 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,8 @@ rules:
resources:
- configmaps
- events
- secrets
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- ""
resources:
- namespaces
- secrets
verbs:
- create
- delete
Expand All @@ -36,7 +25,6 @@ rules:
- clusters
- clusters/status
verbs:
- create
- get
- list
- patch
Expand All @@ -52,6 +40,7 @@ rules:
- update
- apiGroups:
- infrastructure.cluster.x-k8s.io
- operator.cluster.x-k8s.io
resources:
- '*'
verbs:
Expand All @@ -66,31 +55,43 @@ rules:
- management.cattle.io
resources:
- clusterregistrationtokens
- clusterregistrationtokens/status
- clusters
- clusters/status
verbs:
- create
- delete
- deletecollection
- get
- list
- patch
- update
- watch
- create
- apiGroups:
- management.cattle.io
resources:
- clusterregistrationtokens/status
- settings
verbs:
- get
- list
- watch
- apiGroups:
- provisioning.cattle.io
resources:
- clusters
- clusters/status
verbs:
- create
- delete
- deletecollection
- get
- list
- patch
- update
- watch
- apiGroups:
- provisioning.cattle.io
- turtles-capi.cattle.io
resources:
- clusters
- clusters/status
- capiproviders
verbs:
- create
- delete
Expand All @@ -102,25 +103,34 @@ rules:
- apiGroups:
- turtles-capi.cattle.io
resources:
- capiproviders
- capiproviders/finalizers
verbs:
- update
- apiGroups:
- turtles-capi.cattle.io
resources:
- capiproviders/status
verbs:
- get
- patch
- update
- apiGroups:
- turtles-capi.cattle.io
resources:
- clusterctlconfigs
- clusterctlconfigs/status
verbs:
- get
- list
- watch
- patch
- update
- watch
- apiGroups:
- operator.cluster.x-k8s.io
- turtles-capi.cattle.io
resources:
- '*'
- clusterctlconfigs/finalizers
verbs:
- create
- get
- list
- watch
- patch
- update
- create
- watch
6 changes: 4 additions & 2 deletions internal/controllers/import_controller_v3.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,10 @@ func (r *CAPIImportManagementV3Reconciler) SetupWithManager(ctx context.Context,
// +kubebuilder:rbac:groups=coordination.k8s.io,resources=leases,verbs=get;create;update
// +kubebuilder:rbac:groups=cluster.x-k8s.io,resources=clusters;clusters/status,verbs=get;list;watch;update;patch
// +kubebuilder:rbac:groups=infrastructure.cluster.x-k8s.io,resources=*,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=management.cattle.io,resources=clusters;clusters/status,verbs=get;list;watch;create;update;delete;deletecollection;patch
// +kubebuilder:rbac:groups=management.cattle.io,resources=clusters;clusterregistrationtokens;clusterregistrationtokens/status,verbs=get;list;watch
// +kubebuilder:rbac:groups=management.cattle.io,resources=clusters;clusters/status;clusterregistrationtokens,verbs=get;list;watch;create;update;delete;deletecollection;patch
// +kubebuilder:rbac:groups=management.cattle.io,resources=clusterregistrationtokens/status;settings,verbs=get;list;watch
//
//nolint:lll

// Reconcile reconciles a CAPI cluster, creating a Rancher cluster if needed and applying the import manifests.
func (r *CAPIImportManagementV3Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
Expand Down

0 comments on commit 34e46a0

Please sign in to comment.